信息发布软件,b2b软件,广告发布软件

 找回密码
 立即注册
搜索
查看: 4950|回复: 14
打印 上一主题 下一主题

[『C++图文教程』] 一看就能懂的c++打印案例只属数学课堂范例了

[复制链接]

1868

主题

1878

帖子

1万

积分

积分
10928
跳转到指定楼层
宣传软件楼主
发表于 2017-6-24 22:52:48 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

软件教程首图:

软件教程分类:C++ 图文教程 

软件图文教程视频教程分类:软件图文教程 

软件教程难易程度:软件初级教程 

软件教程发布日期:2017-06-24

软件教程关键字:一看就能懂的c++打印案例只属数学课堂范例了

① 本信息收集于网络,如有不对的地方欢迎联系我纠正!
② 本信息免费收录,不存在价格的问题!
③ 如果您的网站也想这样出现在这里,请您加好友情链接,我当天会审核通过!

④友情链接关键字:软件定制网站 网址:http://www.postbbs.com

软件教程详细描述

 作者构造了Picture类,汇总需求细节,见招拆招,尤其在“接口设计”这一节里,把自己当成客户,跟自己一问一答(“我希望有些什么操作,如何表述这些操作?”),逐步分析不断复杂的需求,然后抽象出接口,其中不乏作者的经验之谈:要想决定具体操作的形式,有一个好办法,就是试着使用这些操作,从使用的例子推导出操作的定义形式要比从头苦思冥想地发明这些操作容易得多。

  1、最初需求是打印如下文字:

  Paris

  in the

  Spring

  2、构造的Picture类,只需要一个构造函数和一个输出即可完成,如果打印如下文字:

  +-------+

  |Paris  |

  |in the |

  |Spring|

  +-------+

  3、如果使用C式的过程代码,需要做些打印内容的改变可以完成,作者为Picture类添加了一个frame(Picture&)来完成,如果打印内容改变了,我想C式代码作者就会抓头皮了:

  Paris  +-------+

  in the |Paris  |

  Spring|in the |

  |Spring|

  +-------+

  4、Picture类便有了 Picture operator |(const Picture&, const Picture&) 接口,用字符‘|’做两个Picture对象的横向合并,用Picture operator &(const Picture&,const Picture&)接口,用字符‘&’做纵向合并,当我们需要打印如下文字的时候:

  +--------------+

  |+------+      |

  ||Paris |      |

  ||in the|      |

  ||Spring|      |

  |+------+      |

  |Paris +------+|

  |in the|Paris ||

  |Spring|in the||

  |      |Spring||

  |      +------+|

  +--------------+

  我们只需要一句 cout << frame(frame(p) & (p | frame(p))) << endl即可完成。

  下面是Picture类的源码(原书代码中有些许错误,均做过修改和测试):

  1 #include <iostream>

  2

  3

  4  using namespace std;

  5

  6  class Picture

  7 {

  8     friend Picture frame(const Picture&);                      //加框

  9      friend Picture operator&(const Picture&, const Picture&);  //纵向合并

  10      friend Picture operator|(const Picture&, const Picture&);  //横向合并

  11      friend ostream& operator << (ostream& o, const Picture& p);

  12  private:

  13     int height, width;

  14     char* data;

  15     char& position(int row, int col){

  16         return data[row * width + col];

  17     };

  18     char position(int row, int col) const{

  19         return data[row * width + col];

  20     };

  21     void copyblock(int,int,const Picture&);

  22 public:

  23     Picture() : height(0),width(0),data(0){};

  24     Picture(const char* const*, int);

  25     Picture(const Picture& );

  26     ~Picture();

  27     Picture& operator=(const Picture&);

  28     static int max(int m, int n)

  29     {

  30         return m > n ? m : n;

  31     };

  32     void init(int h, int w);

  33     void clear(int , int ,int ,int );

  34 };

  35

  36 ostream&

  37 operator << (ostream& o, const Picture& p)

  38 {

  39     for(int i = 0; i < p.height; ++i)

  40     {

  41         for(int j =0; j < p.width; ++j)

  42             o << p.position(i,j);

  43         o << endl;

  44     }

  45     return o;

  46 };

  47

  48

  49 void Picture::init(int h, int w)

  50 {

  51     height = h;

  52     width = w;

  53     data = new char[height * width];

  54 };

  55

  56 Picture:icture(const char* const* array, int n)

  57 {

  58     int w = 0;

  59     int i ;

  60     for(i = 0; i < n; i++)

  61         w = Picture::max(w, strlen(array));

  62     init(n,w);

  63     for(i = 0; i < n; i++)

  64     {

  65         const char* src = array;

  66         int len = strlen(src);

  67         int j = 0;

  68         while(j < len)

  69         {

  70             position(i,j) = src[j];

  71             ++j;

  72         }

  73         while(j < width)

  74         {

  75             position(i, j) = ' ';

  76             ++j;

  77         }

  78     }

  79 }

  80

  81 Picture:icture(const Picture& p):

  82          height(p.height), width(p.width),

  83          data(new char[p.height * p.width])

  84 {

  85     copyblock(0,0,p);

  86 }

  87

  88 Picture::~Picture()

  89 {

  90     delete []data;

  91 }

  92

  93 Picture& Picture:perator=(const Picture& p)

  94 {

  95     if(this != &p)

  96     {

  97         delete []data;

  98         init(p.height,p.width);

  99         copyblock(0,0,p);

  100     }

  101     return *this;

  102 }

  103

  104 void Picture::copyblock(int row,int col,const Picture& p)

  105 {

  106     for(int i =0; i < p.height; ++i)

  107     {

  108         for(int j =0; j < p.width; ++j)

  109             position(i+row, j+col) = p.position(i,j);

  110     }

  111 }

  112

  113 void Picture::clear(int h1,int w1,int h2,int w2)

  114 {

  115     for(int r = h1; r < h2; ++r)

  116         for(int c = w1; c < w2; ++c)

  117             position(r,c) = ' ';

  118 }

  119

  120 Picture frame(const Picture& p)

  121 {

  122     Picture r;

  123     r.init(p.height + 2, p.width + 2);

  124     for(int i = 1; i < r.height -1; ++i)

  125     {

  126         r.position(i,0) = '|';

  127         r.position(i, r.width - 1) = '|';

  128     }

  129     for(int j = 1; j < r.width - 1; ++j)

  130     {

  131         r.position(0, j) = '-';

  132         r.position(r.height - 1, j) = '-';

  133     }

  134     r.position(0, 0) = '+';

  135     r.position(0, r.width-1) = '+';

  136     r.position(r.height-1, 0)= '+';

  137     r.position(r.height-1,r.width-1)='+';

  138     r.copyblock(1,1,p);

  139     return r;

  140 }

  141

  142 Picture operator&(const Picture& p, const Picture& q)

  143 {

  144     Picture r;

  145     r.init(p.height + q.height, Picture::max(p.width ,q.width));

  146     r.clear(0,p.width,p.height,r.width);

  147     r.clear(p.height,q.width,r.height,r.width);

  148     r.copyblock(0,0,p);

  149     r.copyblock(p.height,0,q);

  150     return r;

  151 }

  152

  153 Picture operator|(const Picture& p, const Picture& q)

  154 {

  155     Picture r;

  156     r.init(Picture::max(p.height,q.height),p.width + q.width);

  157     r.clear(p.height,0,r.height,q.width);

  158     r.clear(q.height,p.width,r.height,r.width);

  159     r.copyblock(0,0,p);

  160     r.copyblock(0,p.width,q);

  161     return r;

  162 }

  测试代码:

  1 char *init[]= {"aris","in the","Spring"};

  2 Picture p(init,3);

  3 cout << frame(frame(p) & (p | frame(p))) << endl;


设计一个编写仅包含C++程序基本构成元素的程序
/*      //注释行开始
This is the first C++ program.      
Designed by zrf
*/     //注释行结束
#include <iostream>    //包含头文件
using namespace std;    //打开命名空间std
// This is the main function //单行注释语句
int main(void)    //主函数,程序入口
{    //块作用域开始
int age;     //声明一个变量
   age= 20;       //赋值语句
   cout<<"The age is:\n";   //输出一个字符串
   cout<<age<<endl;      //输出变量中的值
return 0;     //主函数返回0
}    //块作用域结束   

   

【案例2-2】计算圆的周长和面积——C++语言中常量、变量
#include <iostream>
using namespace std;
int main()
{ const float PI=3.1415926;  //float 型常量
float r=2.0;    //用float 型常量初始化变量
cout<<"r="<<r<<endl;  //输出圆的半径
float length;    //float型变量声明
length=2*PI*r;    //计算圆的周长
cout<<"Length="<<length<<endl; //输出圆的周长
float area=PI*r*r;   //计算圆的面积
cout<<"Area="<<area<<endl; //输出圆的面积
return 0;
}

【案例2-3】整数的简单运算——除法、求余运算法和增量减量运算符
#include <iostream>
using namespace std;
int main()
{ int x, y;
x = 10;  y = 3;
cout << x << " / " << y << " is " << x / y    //整数的除法操作
    <<" with x % y is " << x % y << endl;     //整数的取余操作
x ++;   --y ;      //使用增量减量运算符
cout << x << " / " << y << " is " << x / y << "\n"     //整数的除法操作
    << x << " % " << y << " is " << x % y<<endl;  //整数的取余操作
return 0;
}

【案例2-4】多重计数器——前置和后置自增运算符
#include<iostream>  
using namespace std;
int main()   
{ int iCount=1; iCount=(iCount++)+(iCount++)+(iCount++); //后置++
cout<<"The first  iCount="<<iCount<<endl;
iCount=1; iCount=(++iCount)+(++iCount)+(++iCount); //前置++
cout<<"The second iCount="<<iCount<<endl;
iCount=1; iCount=-iCount++;    //后置++
cout<<"The third  iCount="<<iCount<<endl;
iCount=1; iCount=-++iCount;    //前置++
cout<<"The fourth  iCount="<<iCount<<endl;
return 0;
}

【案例2-5】对整数“10”和“20”进行位运算——位运算的应用
#include <iostream>
using namespace std;
int main()     
{   cout << "20&10=" << (20&10) << endl;  //按位与运算
    cout << "20^10=" << (20^10) << endl;  //按位异或运算
    cout << "20|10=" << (20|10) << endl;  //按位或运算
    cout << "~20=" <<(~20) << endl;          //按位取反运算
    cout << "20<<3=" << (20<<3) << endl;  //左移位运算
    cout << "-20<<3=" << (-20<<3) << endl;  //左移位运算
    cout << "20>>3=" << (20>>3) << endl;  //右移位运算
    cout << "-20>>3=" << (-20>>3) << endl;  //右移位运算
return 0;
}

【案例2-6】实现逻辑“异或”运算——逻辑运算应用
#include <iostream>
using namespace std;
int main()
{ bool p, q;
p = true;   q = true;
cout <<p <<" XOR "<<q<<" is "<<( (p || q) && !(p && q) )<< "\n"; //输出异或结果
p = false;   q = true;
cout <<p<<" XOR "<<q<< " is "<<( (p || q) && !(p && q) )<< "\n"; //输出异或结果
p = true;   q = false;
cout <<p<<" XOR "<<q<<" is "<<( (p || q) && !(p && q) )<< "\n"; //输出异或结果
p = false;   q = false;
cout <<p<<" XOR "<<q<<" is "<<( (p || q) && !(p && q) )<< "\n"; //输出异或结果
return 0;
}

【案例2-7】高效筛选器——用条件运算符“?”构建条件表达式
#include<iostream>
using namespace std;
int main()
{ int iNum1=1,iNum2,iMax;
cout<<"lease input two integers:\n";
   cin>>iNum1>>iNum2;
iMax = iNum1>iNum2 ? iNum1 : iNum2;  //使用条件运算符构建条件表达式
cout<<"The max integer is: "<<iMax<<endl;
   return 0;
}

【案例2-8】“多计算与单提取”功能的实现——逗号表达式
#include<iostream>
using namespace std;
int main()
{   int Val1, Val2, Val3, Left, Midd, Righ;
Left = 10; Midd = 20;   Righ = 30;
   Val1 = (Left++, --Midd, Righ++);   //使用逗号表达式
Val2 = (Righ++, Left++, --Midd);  //使用逗号表达式
Val3 = ( --Midd, Righ++,Left++);  //使用逗号表达式
    cout <<"Val1=\t"<<Val1 <<"\nVal2=\t"<<Val2 <<"\nVal3=\t"<<Val3<<endl;
    return 0;
}

【案例2-9】高效的算术运算符——复合赋值运算符
#include <iostream>
using namespace std;
int main()
{ int n=20;  cout << "n = " << n << endl;
n += 8;   cout << "After n += 8, n = " << n << endl;  //使用复合的赋值运算符+=
n -= 6;   cout << "After n -= 6, n = " << n << endl;  //使用复合的赋值运算符-=
n *= 1;   cout << "After n *= 1, n = " << n << endl; //使用复合的赋值运算符*=
n /= 4;   cout << "After n /= 4, n = " << n << endl;  //使用复合的赋值运算符/=
n %= 3;  cout << "After n %= 3, n = " << n << endl;  //使用复合的赋值运算符%=
return 0;
}

【案例2-10】计算不同数据类型的存储容量——sizeof运算符
#include <iostream>
using namespace std ;
int main()
{ cout << "The size of an int is:\t\t" << sizeof(int) << " bytes.\n";
cout << "The size of a short int is:\t" << sizeof(short) << " bytes.\n";
cout << "The size of a long int is:\t" << sizeof(long) << " bytes.\n";
cout << "The size of a char is:\t\t" << sizeof(char) << " bytes.\n";
cout << "The size of a wchar_t is:\t" << sizeof(wchar_t) << " bytes.\n";
cout << "The size of a float is:\t\t" << sizeof(float) << " bytes.\n";
cout << "The size of a double is:\t" << sizeof(double) << " bytes.\n";
return 0;
}

【案例2-11】巧妙获取整数部分——double和int数据类型的转换
#include <iostream>
using namespace std;
int main()
{   int nn=10,mm;
    double xx=4.741,yy;
    cout<<"nn*xx="<<nn*xx<<endl;     //表达式类型转换
    mm=xx;    yy=nn;         //赋值类型转换
    cout<<"mm="<<mm<<endl <<"yy="<<yy<<endl;
    cout<<"int(xx)="<<int(xx)<<endl <<"(int)xx="<<(int)xx<<endl;    //强制类型转换
    cout<<"int(1.412+xx)="<<int(1.412+xx)<<endl;      //强制类型转换
    cout<<"(int)1.412+xx="<<(int)1.412+xx<<endl;     //强制类型转换
return 0;
}

【案例2-12】将分数转换为小数——强制类型转换
#include <iostream>
using namespace std;
int main()
{ for( int i=1; i <= 5; ++i )
  cout << i << "/ 3 is: " << (float) i / 3 << endl;     //强制类型转换
return 0;
}

【案例2-13】安全的除法计算器
#include <iostream>
using namespace std;
int main()
{ int a, b;
cout << "Enter numerator: ";    cin >> a;
cout << "Enter denominator: ";    cin >> b;
if(b) cout << "Divide Result is: " << a / b << '\n';  //排除除数为零的情况
else cout << "Divide by zero!\n";
return 0;
}

【案例2-14】猜数游戏——嵌套的if条件语句
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{ int MagNum, GueNum;  
MagNum = rand();      //产生随机数
cout << "Enter the Guess number: ";   cin >> GueNum;
if (GueNum == MagNum)
{        //if语句块起始位置
  cout << "* It is Right *\n"<< MagNum << " is the Magess number.\n";
}       //if语句块结束位置
else
{        // else语句块起始位置
  cout << "Sorry, you're wrong."<<endl;
  if(GueNum > MagNum)
       cout <<"Guessed number is too high.\n";
  else
      cout << "Guessed number is too low.\n";
}        //else语句块结束位置
return 0;
}

【案例2-15】根据输入月份输出从年初到本月底的天数——不带break的switch
#include <iostream>
using namespace std;
int main()
{ int year,month,days=0;
cout<<"Input year and month:";  cin>>year>>month;
switch (month)       //每个case分支均没有break语句
{ case 12: days +=31;
  case 11: days +=30;
  case 10: days +=31;
  case  9: days +=30;
  case  8: days +=31;
  case  7: days +=31;
  case  6: days +=30;
  case  5: days +=31;
  case  4: days +=30;
  case  3: days +=31;
  case  2:      //判断是否为闰年
   if (year % 4==0 && year % 100!=0 || year %400==0)
           days +=29;
   else
           days +=28;
  case  1: days +=31;
}
if (days==0)    cout<< "Wrong month"<<endl;
else     cout << "Total days is:" <<days<< endl;
return 0;
}

【案例2-16】计算数的阶乘——do-while循环语句
#include <iostream>
using namespace std;
int main()
{  long limits;
   cout << "Enter a positive integer: ";   cin >> limits;
   cout << "Factorial numbers of "<<0<<" is " << 1<<endl;
   cout << "Factorial numbers of "<<1<<" is " << 1<<endl;
   long fac=1, i=1;
   do       //使用do-while循环
{  fac *= ++i;
       cout << "Factorial numbers of "<<i<<" is " << fac<<endl;
} while (fac < limits);
   return 0;
}

【案例2-17】计算数的阶乘——for循环
#include <iostream>
using namespace std;
int main()
{  long limits;
   cout << "Enter a positive integer: ";   cin >> limits;
   cout << "Factorial numbers of "<<0<<" is " << 1<<endl;
   cout << "Factorial numbers of "<<1<<" is " << 1<<endl;
   long fac=1;
for(int i=2;fac<=limits;i++)    //使用for 循环
{  fac *= i;
    cout << "Factorial numbers of "<<i<<" is " << fac<<endl;
}
return 0;
}

【案例2-18】筛选素数——步长为2的for循环
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{ long n;
cout << "Enter a positive integer: ";  cin >> n;
if (n < 2)
      cout << n << " is not prime." << endl;
else if (n < 4)
      cout << n << " is prime." << endl;
else if (n%2 == 0)
      cout << n << " = 2*" << n/2 << endl;
else
{ for (int i=3; i <= n/2; i += 2)  //步长为2
    if (n%i == 0)  
        {cout << n << " = " << i << "*" << n/i << endl;  exit(0);}
  cout << n << " is prime." << endl;
}
return 0;
}

【案例2-19】输出1~20之间的偶数——continue语句
#include <iostream>
using namespace std;
int main()
{ cout<<"The even numbers are as follows:"<<endl;
for(int i=0; i<=20; i++)
{ if(i%2) continue;  //根据条件使用continue结束本次循环
  cout << i << ' ';
}
return 0;
}

【案例2-20】统计输入整数的个数并求和——exit()函数
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{ int sum=0,num=0,m;
cout<<"lease input integers (0:end):"<<endl;
do { cin>>m;   num++;   sum+=m;
     if(m==0)
     { cout<<"Entered numbers:"<<num<<" integers.\n";
   cout<<"The sum is:"<<sum<<endl;
   exit(0); // 使用exit()函数终止程序
     }
}while(1);
return 0;
}

【案例2-21】“剪刀、石头、布”游戏——枚举类型
#include <iostream>
using namespace std;
enum Choice {ROCK, CLOTH, SCISS}; //声明枚举类型Choice
enum Winner {Play1, Play2, Tie};   //声明枚举类型Winner
int main()
{ int n;
   Choice cho1, cho2;  
   Winner winner;
cout << "Choose rock (0), cloth (1), or Sciss (2):" << endl;
cout << "layer No. 1: "; cin >> n; cho1 = Choice(n);
cout << "layer No. 2: "; cin >> n; cho2 = Choice(n);
if (cho1 == cho2) winner = Tie;
else if (cho1 == ROCK)
  if (cho2 == CLOTH)  winner = Play2;
  else  winner = Play1;
else if (cho1 == CLOTH)
  if (cho2 == SCISS)  winner = Play2;
  else  winner = Play1;
else
  if (cho2 == ROCK)  winner = Play2;
  else  winner = Play1;
if (winner == Tie)   cout << "\tTied!\n";
else if (winner == Play1)  cout << "\tPlayer No. 1 wins." <<endl;
else  cout << "\tPlayer No. 2 wins." << endl;
return 0;
}

【案例2-22】简单的学生信息类型——结构体
#include <iostream>
#include <iomanip>
using namespace std;
struct student             //学生信息结构体
{   int num;
    char name[20];
    char gender;
    int age;
}stu1={1001,"Zhang San",'M',19};
int main()
{ student stu2={1002,"Li Si",'M',20};  //声明结构体变量并初始化
student stu3={1003,"Wang Hong",'F',22};         //声明结构体变量并初始化
    cout<<setw(7)<<stu1.num<<setw(20)<<stu1.name<<setw(3)<<stu1.gender<<setw(3)<<stu1.age<<endl;
cout<<setw(7)<<stu2.num<<setw(20)<<stu2.name<<setw(3)<<stu2.gender<<setw(3)<<stu2.age<<endl;
cout<<setw(7)<<stu3.num<<setw(20)<<stu3.name<<setw(3)<<stu3.gender<<setw(3)<<stu3.age<<endl;
return 0;
}

【案例2-23】综合案例——百钱买百鸡问题
#include<iostream>
using namespace std;
int main()  
{  
   int n=100;
   cout<<"鸡公  鸡母  鸡雏"<<endl;      //i表示鸡公,j表示鸡母,k表示鸡雏
   for ( int i = 1; i <= n; i++ )
   for ( int j = 1; j <= n; j++ )
    for( int k = 1; k <= n; k++ )
     if(( n == 5 * i + 3 * j + k / 3 ) && ( k % 3 == 0 ) && ( n == i + j + k ))
       cout << i << "  " << j << "  " << k << endl;
   return 0;
}


#include<stdio.h>
int main()
{
   int x,y,z,j=0;
   printf("Folleing are possible plans to buy 100 fowls with 100 Yuan.\n");
   for(x=0;x<=20;x++)         //外层循环控制鸡翁数
      for(y=0;y<=33;y++)      //内层循环控制鸡母数y在0~33变化
      {
         z=100-x-y;           //内外层循环控制下,鸡雏数z的值受x,y的值的制约
         if(z%3==0&&5*x+3*y+z/3==100)        //验证取z值的合理性及得到一组解的合理性
               printf("%2d:cock=%2d hen=%2d chicken=%2d\n",++j,x,y,z);
      }
}

【案例3-1】编写输出专用函数——无参函数
#include<iostream>
using namespace std;
void DispMessage(void)                    //定义无参函数
{
    cout<<"This is a Message!"<<endl;
}      
int main()
{
    DispMessage();                            //调用无参函数DispMessage
    return 0;
}
【案例3-2】编写求和函数——有参函数
#include<iostream>
using namespace std;
double add(double x,double y)                    //定义有参函数
{
    double z;    z=x+y;    return(z);
}
int main()
{   
    double a=0.5, b=1.0;
    cout<<"add(a,b)="<<add(a,b)<<endl;   //调用有参函数add()
    return 0;
}
【案例3-3】编写求和函数——函数的不同调用形式
#include<iostream>
using namespace std;
double add(double x,double y)                    //函数的定义,其有返回值
{   
    double z;    z=x+y;
    cout<<x<<"+"<<y<<"="<<z<<endl;
    return(z);
}
int main()
{
    double a=0.5,b=1.0;
//以不同参数形式调用函数add()
    cout<<"add(1.5,2.5)="<<add(1.5,2.5)<<endl;
    cout<<"add(a,b)="<<add(a,b)<<endl;
    cout<<"add(2*a,a+b)="<<add(2*a,a+b)<<endl;
    double c=2*add(a,b);                                     //以表达式方式调用函数add()
    cout<<"c="<<c<<endl;
    add(2*a,b);                                                     //以语句方式调用函数add()
    cout<<" add(a, add(a,b))="<<add(a, add(a,b))<<endl;       //以函数参数形式调用函数add()
    return 0;
}
【案例3-4】编写符号函数——函数的返回值
#include<iostream>
using namespace std;
int sgn(double x)                       //定义符号函数sgn(),其返回值为int类型
{   
    if (x>0) return(1);                  //返回出口1
    if (x<0) return(-1);                //返回出口2
    return(0);                             //返回出口3
}
int main()
{   
    double x;  
    for (int i=0;i<=2;i++)
    {
       cout<<"Input x=";     cin>>x;
       cout<<"sgn("<<x<<")="<<sgn(x)<<endl;
    }
    return 0;
}
【案例3-5】编写最值函数——函数原型声明
#include<iostream>
using namespace std;
//…函数原型声明语句也可以在这里
int main()  
{   
    float max(float,float);                            //max()函数原型声明语句
    float a,b,Max;                                      //变量声明语句
    cout<<" Input a=";    cin>>a;              //输入参数a
    cout<<" Input b=";    cin>>b;             //输入参数b
    Max=max(a,b);                                 //调用max()函数
    cout<<"max("<<a<<","<<b<<")="<<Max<<endl;
    return 0;
}
float max(float x,float y) {
    float z;    z=(x>y)?x:y;   
    return(z);                                           //返回值类型为浮点型
}
【案例3-6】值传递和引用传递的区别
#include <iostream>
using namespace std;
void fun(int,int&);                             //函数参数一个为值传递,一个引用传递
int main()
{
    int a = 22, b = 44;
    cout << "Initial a = " << a << ", b = " << b << endl;
    fun(a,b);    cout << "After fun(a,b), a = " << a << ", b = " << b << endl;
    fun(2*a-3,b);   cout << "After fun(2*a-3,b), a = " << a << ", b = " << b << endl;
    return 0;
}
void fun(int x, int& y)
{
    x = 88;  y = 99;
}
【案例3-7】编写最值函数——内联函数
#include<iostream>
using namespace std;
inline int max(int x,int y)                  //使用inline关键字声明max()为内联函数
{
    return x>y?x:y;
}
int main()
{   
    int a=3,b=5,c;
    c=max(a,b);    cout<<"max("<<a<<","<<b<<")="<<c<<endl;
    cout<<"max("<<15<<","<<11<<")="<<max(15,11)<<endl;
    return 0;
}
【案例3-8】计算圆的面积和周长函数——通过引用返回多于1个的数值
#include <iostream>
using namespace std;
void ComCircle(double&, double&, double);            //函数的原型声明
int main()
{
    double r, a, c;
    cout << "Enter radius: ";  cin >> r;
    ComCircle(a, c, r);
    cout << "The area = " << a << ", and the circumference = " << c << endl;
    return 0;
}
void ComCircle(double& area, double& circum, double r)        //通过引用变量返回面积和周长
{
    const double PI = 3.141592653589793;
    area = PI*r*r;  circum = 2*PI*r;                                         //计算面积和周长
}
【案例3-9】最小公倍数函数——函数的嵌套调用
#include <iostream>  
using namespace std;
long int gcd(long int m,long int n)                              //求最大公约数
{
    if (m < n) swap(m,n);
while (n>0)
        {
            int r = m%n; m = n;   n = r;  
        }
    return m;
}
long int lcm(long int m,long int n)                            //求最小公倍数
{
    return m*n/gcd(m,n);
}
int main()
{
    int m, n;
    cout << "lease input two integers: "; cin >> m >> n;
    cout << "lcm(" << m << "," << n << ") = " << lcm(m,n) << endl;
    return 0;
}
【案例3-10】显示函数的参数——带默认参数的函数
#include <iostream>
using namespace std;
void disp(int x=1,int y=1,int z=1)                         //带有默认参数值的函数
{   
    cout<<"arameter 1 is: "<<x<<endl;
    cout<<"arameter 2 is: "<<y<<endl;
    cout<<"arameter 3 is: "<<z<<endl;
}
int main()                                       //main()函数中测试参数带有默认值的函数disp()
{
    cout<<"No actual parameter"<<endl;    disp();
    cout<<"One actual parameter"<<endl;    disp(1);
    cout<<"Two actual parameter"<<endl;    disp(1,2);
    cout<<"Three actual parameter"<<endl;    disp(1,2,3);
    return 0;
}
【案例3-11】通用最值函数——参数数目可变的函数
#include <iostream>
#include <cstdarg>
using namespace std;
int max(int,int...);                                //原型声明
int main()
{
    int a,b,c,d,e;
    cout<<"Enter five integers, seperate with space:"; cin>>a>>b>>c>>d>>e;
    cout<<"The maxmum in a and b is:"<<max(2,a,b)<<endl;
    cout<<"The maxmum in five integers is:"<<max(5,a,b,c,d,e)<<endl;
    return 0;
}
int max(int num,int integer...)             //定义参数数目可变的函数
{
    va_list ap;
    int n=integer;
    va_start(ap,integer);
    for(int i=1;i<num;i++)
    {
int t=va_arg(ap,int);
if(t>n)
           n=t;
    }
    va_end(ap);
    return n;
}
【案例3-12】多变的最值函数——参数数目不同的重载函数
#include <iostream>
using namespace std;
int main()
{
    int min (int a, int b, int c);                        //函数声明
    int min (int a, int b);                                //函数声明
    int i1 ,i2,i3,i;
    cout<<"Enter three integers:"; cin >>i1 >>i2 >>i3;                    //输入3个整数
    i = min(i1 ,i2) ;  cout <<"The min in two intergers=" <<i <<endl;     // 2个整数中最小者
    i = min(i1 ,i2 ,i3) ;                                 // 3个整数中最小者
    cout <<"The min in three intergers=" <<i <<endl;
    return 0;
}
int min(int a,int b,int c)                             //定义求3个整数中的最小者的函数
{
    int k;  
    k=(a<b)?a:b;
    k=(k<c)?k:c;
    return k;
}
int min(int a,int b)                                    //定义求2个整数中的最小者的函数
{
    int k;
    k=(a<b)?a:b;
    return k;
}
【案例3-13】求绝对值——使用系统函数
#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
void main( void )
{
    int     ix = -4, iy;
    long    lx = -41567L, ly;
    double  dx = -3.141593, dy;
    iy = abs( ix );   cout<<"The absolute value of"<<ix <<" is "<<iy<<endl;
    ly = labs( lx );   cout<<"The absolute value of"<<lx <<" is "<<ly<<endl;
    dy = fabs( dx );   cout<<"The absolute value of"<<dx <<" is "<<dy<<endl;
}
【案例3-14】将整数和小数分离——使用系统函数
#include<iostream>
#include<cmath>
using namespace std;
void main(void)
{
    double fraction, integer,number = 103.567;
    fraction = modf(number, &integer);
    cout<<number<<"整数部分为:"<<integer<<" 小数部分为:"<<fraction;
}
【案例3-15】求平方根——使用系统函数
#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
void main( void )
{
    double question = 45.35, answer;
    answer = sqrt( question );
    if( question < 0 )
       cout<<"Error: sqrt returns "<<answer<<endl;
    else
       cout<<"The square root of "<<question<<" is "<<answer<<endl;
}
【案例3-16】求随机数——使用系统函数
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void main(void)
{
    cout << "RAND_MAX=" << RAND_MAX << endl;
    cout<<"产生10个 0 到 99的随机数如下:\n";
    for(int i=0; i<10; i++)   
        cout<<(rand() % 100)<<' ';                          //求除以100的余数
    cout << "\n使用srand:\n";
    srand( (unsigned)time( NULL ) );
    for( i = 0; i < 10;i++ )
        cout<<rand() <<' ';
}
【案例3-17】计算时间差——使用系统函数
#include <iostream >
#include <ctime >
#include <conio.h>
using namespace std;
void main(void)
{
    time_t start,end;
    start = time(NULL);
    cout << "请按Enter键!\n";
    for (;;)  
    {
        if (getch()=='\r')
            break;
    }
    end = time(NULL);
    cout << "按键前后相差:"<<difftime(end,start)<<" 秒";
}
【案例4-1】编写设计全部成员为public模式的类
#include<iostream>
using namespace std;
class PubClass
{public:                                                          //以下成员均为公有成员
    int value;                                                    //公有数据成员
    void set(int n)                                          //公有函数成员
    {   
        value=n;
    }   
    int get(void)                                             //公有函数成员
    {
        return value;
    }   
};
int main()
{
    PubClass a;                                                               //创建对象
    a.set(10); cout<<"a.get()="<<a.get()<<endl;              //直接访问对象的公有成员函数
    a.value=20; cout<<"a.value="<<a.value<<endl;       //直接访问对象的公有数据成员
    return 0;
}
【案例4-2】编写设计private数据访问模式的类
#include <iostream>
using namespace std;
class PriClass
{   
    int iv;    double dv;                                         //私有数据成员
public:
    void set_PriClass(int n,double x);           //公有函数成员为接口函数
    void show_PriClass(char*);                     //公有函数成员为接口函数
};
//定义PriClass类的接口成员函数
void PriClass::set_PriClass(int n,double x) { iv=n;  dv=x;}
void PriClass::show_PriClass(char *name)
{   
    cout<<name<<": "<<"iv=" <<iv<< ", dv=" <<dv<< endl;
}
int main()
{   
    PriClass obj;      
    obj.show_PriClass("obj");                            //通过接口函数来访问数据成员
    obj.set_PriClass(5,5.5);  obj.show_PriClass("obj");       //通过接口函数来访问数据成员
    return 0;
}
【案例4-3】编写结构体类——以结构体形式定义类
说明:结构体和类唯一区别是:结构体成员的访问权限默认为公有的,而类成员的访问权限默认为私有的
#include<iostream>
using namespace std;
struct StructClass                               //用struct关键字定义StructClass类
{
    void set_value(int n)                                    //公有属性
    {
        value=n;
    }      
    void show_value(char *name)                 //公有属性
    {
        cout<<name<<": "<<value<<endl;
    }  
private:                                //为了保持私有属性,不能省略private                  
    int value;
};
int main()
{   
    StructClass a;      
    a.show_value ("a");                                  //通过对象访问公有属性函数
    a.set_value(100);   
    a.show_value ("a");                                 //通过对象访问公有属性函数
    return 0;
}
【案例4-4】完善有理数类——拷贝构造函数的调用时机
#include <iostream>
using namespace std;
int gcd(int m, int n)                                        //返回m 和n最大公约数
{
    if (m<n)  swap(m,n);
    while (n>0)  { int r=m%n;    m = n;    n = r;  }
    return m;
}
class Ratio
{
public:
    Ratio(int n=0, int d=1) : num(n), den(d)  
    {  
        cout << "Common constructor called\n"; reduce();
    }
    Ratio(const Ratio& r):num(r.num), den(r.den)                       //拷贝构造函数
    {
        cout << "Copy constructor called\n";
    }
    void disp()
    {
        cout <<num<<"/"<<den<<endl;
    }
private:
    int num, den;
    void reduce()
    {
        if (num == 0 || den == 0)  
        {
         num = 0; den = 1; return; }
     if (den < 0) {den *= -1; num *= -1; }
     if (den == 1) return;
     int sgn = (num<0?-1:1);  int g = gcd(sgn*num,den);
     num /= g;  den /= g;
  }
};
Ratio func(Ratio r)                                      //初始化形参时调用拷贝构造函数
{
    Ratio s = r;
   return s;                                                       //返回时调用拷贝构造函数
}
int main()
{  
    Ratio x(20,7);
    cout<<"Ratio x is:"; x.disp();
    Ratio y(x);                                       //调用拷贝构造函数,用x初始化y
    cout<<"Ratio y is:"; y.disp();
    cout<<"Func() Start:"<<endl;
    func(y);                                                //调用拷贝构造函数3次
    cout<<"Func() End"<<endl;
    return 0;
}
【案例4-5】完善的有理数类——析构函数
#include <iostream>
using namespace std;
class Ratio
{  
    int num, den;
    public:
       Ratio()          {cout << "Constructor called.\n";}
       Ratio(Ratio &r)  { cout << "Copy constructor called.\n"; }
       ~Ratio()         { cout << "Destructor called.\n"; }
};
int main()
{
    Ratio x;   
    {                                        //x的作用域开始
        Ratio y;                             //y的作用域开始
cout << "Now y is alive.\n";
    }                                         //y的作用域结束,调用析构函数1次
    cout << "Now between blocks.\n";
    {
        Ratio z(x);                                 //z的作用域开始
        cout << "Now z is alive.\n";
    }                                                  //z的作用域结束,调用析构函数1次
    return 0;
}     
                                                     //x的作用域结束,调用析构函数1次
【案例4-6】综合案例——电子日历
#include <iostream >
#include <cstdlib >
using namespace std;
class CDate                                                                 //定义电子日历类
{   
    int m_nDay;  int m_nMonth;  int m_nYear;            //日月年
public:
    CDate(){};                                                               //默认构造函数
    CDate(int year, int month,int day )                         //带参构造函数
    {
        SetDate(year, month, day);                                  //调用成员函数来初始化
    };   
    void Display();      //显示日期
    void AddDay();      //返回加1后的日期
    void SetDate(int year, int month, int day)              //设置日期
    {
        m_nDay=day;    m_nMonth=month;     m_nYear=year;
    }
    ~CDate() {};
private:
    bool IsLeapYear() ;                                               //判断是否为闰年
};
void CDate:isplay()                                              //显示日期
{   
    char day[5] ,month[5], year[5] ;
    _itoa (m_nDay, day, 10) ;  
    _itoa (m_nMonth, month, 10) ;  
    _itoa(m_nYear,year, 10) ;
    cout << day << "/" << month << "/" << year << endl;
}
void CDate::AddDay ()                                              //返回加1后的日期
{   
    m_nDay++;
    if (IsLeapYear())
    {
        if ((m_nMonth==2) && (m_nDay==30))
        {
            m_nMonth++;
   m_nDay=1;
   return;
        }
    }
    else
    {
         if((m_nMonth==2)&& (m_nDay==29))
         {
             m_nMonth++;
    m_nDay=1;
    return;
         }
    }
    if (m_nDay>31 )
    {
        if(m_nMonth==12)  { m_nYear++;   m_nMonth=1 ;    m_nDay=1 ;  }
        else  { m_nMonth++;  m_nDay=1 ; }
    }
}
bool CDate::IsLeapYear()                                      //判断是否为闰年
{   
    bool bLeap;
    if(m_nYear%4!=0)                    bLeap=false;
    else if(m_nYear%100!=0)      bLeap=true;
    else if(m_nYear%400!=0)      bLeap=false;
    else              bLeap=true;
    return bLeap;
}
void main ()
{
    CDate d (2010,4,6);                                            //调用构造函数初始化日期
    cout << "Current date:";  
    d.Display();  
    d.AddDay();
    cout << "Add 1 to Current date:";  
    d.Display();
    d. SetDate(2010,4,8);                                          //调用成员函数重新设置日期
    cout << "After reset Date,the date:";      
    d.Display();
}
【案例5-1】局部作用域的效果
#include <iostream>
using namespace std;
void fun()                          //变量num将在每次进入函数fun()时进行初始化
{  
     int num = 10;
     cout << num << "\n";
     num++;                         // 这个语句没有持续效果
}
int main()  
{
     for(int i=0; i < 3; i++)
         fun();   
     return 0;
}
【案例5-2】屏蔽效应——作用域效果导致的名称隐藏
#include <iostream>
using namespace std;
int main()
{  
     int i = 10, j = 30;
     if(j > 0)
     {
         int i;                    // 内部的i 将隐藏或屏蔽外层的i
      i = j / 2;   
         cout << "inner variable i: " << i << '\n';
     }
     cout << "outer variable i: " << i << '\n';
     return 0;
}
【案例5-3】筛选偶数——文件作用域变量
#include <iostream>
using namespace std;
int count;                  //这是一个全局变量  
void func1()
{  
     void func2();
     cout << "count: " << count<< '\n';    //可以访问全局变量count
     func2();
}
void func2()
{  
     int count;      //这是一个局部变量
     for(count=0; count<2; count++)
        cout << '*';
}
int main()
{  
     void func1();
     void func2();
     int i;       //这是一个局部变量  
     for(i=0; i<10; i++)
     {
         count = i++;  
         func1();   
     }
     return 0;
}
【案例5-4】求数据序列的平均值——static局部变量的持续效果
#include <iostream>
using namespace std;
int Average(int i)
{
     static int sum = 0, count = 0;           //声明静态局部变量,具有全局寿命,局部可见
     sum = sum + i;   count++;
     return sum/count;
}
int main()
{
     int num;                                //局部变量,具有动态生存期
do
{
             cout << "Enter numbers (-1 to quit): ";     cin >> num;
      if(num != -1)   
                 cout << "Running average is: " << Average(num);
      cout <<endl;
} while(num > -1);
return 0;
}
【案例5-5】求数据序列的平均值——static全局变量的应用
#include <iostream>
using namespace std;
int Average(int i);
void reset();
int main()
{
     int num;       //局部变量,具有动态生存期
     do
     {
          cout << "Enter numbers (-1 to quit, -2 to reset): ";  
          cin >> num;
   if(num == -2)
          {
               reset();  
               continue;  
          }
   if(num != -1)
               cout << "Running average is: " << Average(num);
   cout << endl;
     } while(num != -1);
     return 0;
}
static int sum = 0, count = 0;                 //静态全局变量,具有静态生存期,全局可见
int Average(int i)
{
     sum = sum + i;  count++;  return sum/count;
}
void reset()
{  
     sum = 0; count = 0;
}
【案例5-6】时钟类——具有静态生存期的全局变量和全局对象
#include<iostream>
using namespace std;
int h=0,m=0,s=0;                 //声明全局变量,具有静态生存期
class Clock
{
public:
     Clock();
     void SetTime(int NewH, int NewM, int NewS);     //三个形参均具有函数原型作用域
     void ShowTime();
     ~Clock(){}
private:
     int Hour,Minute,Second;
};
Clock::Clock()
{
     Hour=h; Minute=m; Second=s;                    //使用全局变量初始化
}
void Clock::SetTime(int NewH, int NewM, int NewS)
{
     Hour=NewH;  Minute=NewM; Second=NewS;
}
void Clock::ShowTime()
{
     cout<<Hour<<":"<<Minute<<":"<<Second<<endl;
}
Clock globClock;                              //声明对象globClock,具有静态生存期,文件作用域
int main()
{
     cout<<"Initial time output:"<<endl;
     //引用具有文件作用域的对象globClock:
     globClock.ShowTime();            //对象的成员函数具有类作用域
     globClock.SetTime(10,20,30);           //将时间设置为10:20:30
     //调用拷贝构造函数,以globClock为初始值
     Clock myClock(globClock);                    //声明具有块作用域的对象myClock
     cout<<"Setted time output:"<<endl;
     myClock.ShowTime();    //引用具有块作用域的对象myClock
     return 0;
}
【案例5-7】实现数据共享——公有静态数据成员
#include <iostream>
using namespace std;
class PubClass
{
public:
     static int num;            //公有静态数据成员的声明
     void shownum() { cout << "The num is:"<<num << endl; }
};
int PubClass::num;            //在类外定义num
int main()
{
     PubClass a, b;
     PubClass::num = 1000;             //通过类名访问静态成员num
     a.shownum();   
     b.shownum();
     a.num = 2000;              //通过对象访问静态成员num
     a.shownum();   
     b.shownum();
     return 0;
}
【案例5-8】实现数据共享——私有型静态数据成员
#include <iostream>
using namespace std;
class PriClass
{
     static int num;        //私有型静态成员
public:
     void setnum(int i) { num = i; };
     void shownum() { cout << "The num is:"<<num << "\n"; }
};
int PriClass::num;      //在类外定义 num
int main()
{
     PriClass a, b;
     a.shownum();   b.shownum();
     a.setnum(1000);     //设置静态成员num为1000
     a.shownum();   b.shownum();
     return 0;
}
【案例5-9】实现函数共享——静态函数成员
#include <iostream>
using namespace std;
class FunClass
{
     static int count;       //静态数据成员声明
public:
     FunClass() { count++;    cout << "Constructing object " <<count << endl;   }
     ~FunClass() { cout << "Destroying object " << count << endl;     count--;   }
     static int GetCount() { return count; }      //静态函数成员
};
int FunClass::count;       //静态数据成员定义
int main()
{
     FunClass a, b, c;
     cout << "From Class, there are now " << FunClass::GetCount() << " in existence.\n";
     cout << "From Object, there are now " << a.GetCount() <<" in existence.\n";
     return 0;
}
【案例5-10】求最小公因子——友元函数的访问类的私有成员
#include <iostream>
using namespace std;
class FriFunClass
{
     int a, b;
public:
     FriFunClass(int i, int j) { a=i; b=j; }
     friend int FriFun(FriFunClass x);        //友元成员函数
};
int FriFun(FriFunClass x)        //注意:FriFun() 不是任何类的成员函数
{
     //由于函数FriFun() 是类FriFunClass的友元函数,所以它不能直接访问a和b
     int max = x.a < x.b ? x.a : x.b;
     for(int i=2; i <= max; i++)
          if((x.a%i)==0 && (x.b%i)==0)
               return i;
     return 0;
}
int main()
{
     FriFunClass n(10, 20);         //声明类对象
     if(FriFun(n))  
          cout << "Common denominator is " <<FriFun(n) << "\n";
     else  cout << "No common denominator.\n";
   return 0;
}
【案例5-11】判断圆柱体和立方体的颜色是否相同——多个类共享友元函数
#include <iostream>
using namespace std;
class Cylinder;         // 前向引用声明
enum Colors { red, green, yellow };       //定义颜色枚举类型
class Cube
{  
Colors color;
public:
     Cube(Colors c) { color = c; }
     friend bool TestSame(Cube x, Cylinder y);      //声明为Cube的友元函数
};
class Cylinder
{  
Colors color;
public:
     Cylinder(Colors c) { color= c; }
     friend bool TestSame(Cube x, Cylinder y);      //声明为Cylinder的友元函数
};
bool TestSame(Cube x, Cylinder y)
{
     if(x.color == y.color)
          return true;   
     else return false;
}  
int main()
{
     Cube cube1(red),  cube2(yellow);   
     Cylinder cyl(yellow);                         //声明对象并初始化
     if(TestSame(cube1, cyl))      
          cout << "The color of cube1 and cyl are the same.\n";
     else   
          cout << "The color of cube1 and cyl are different.\n";
     if(TestSame(cube2, cyl))
          cout << "The color of cube2 and cyl are the same.\n";
     else
          cout << "The color of cube2 and cyl are different.\n";
     return 0;
}
【案例5-12】计算2个三角形之和——友元函数的应用一看就能懂的c++打印案例只属数学课堂范例了
#include <iostream>
#include <cmath>
using namespace std;
class Trig
{
     double  x,y,z;
     double area()  {double d=(x+y+z)/2;  return sqrt(d* (d-x)* (d-y)* (d-z)) ; }
public :
     Trig (int i,int j,int k)  { x=i;y=j;z=k;  }
     int isTriangle()         //判断是否构成三角形
     {
          if  (x+y>z && x+z>y && y+z>x)  
               return 1 ;
   else
               return 0;
     }
     friend  double twoarea(Trig tl,Trig t2)            //声明友元函数
     {
          return tl.area()+t2.area() ;
     }
};
int main()
{
     Trig tl (3,5,7) ,t2 (8, 7, 12) ;
     if (tl.isTriangle() && t2.isTriangle())
          cout << "Total area of two Triangles:" << twoarea(tl,t2)  << endl;
     else  
          cout << "Cannot form a Triangle"<< endl;
     return 0;
}
【案例5-13】数据的单向传递——常引用作函数形参
#include <iostream>  
using namespace std;
//常引用作形参,在函数中不能更新z所引用的对象,因此对应的实参不会被破坏。
void fun(int x, int& y, const int& z)
{  
     x += z;
     y += z;
     cout << "x = " << x << ", y = " << y << ", z = " << z << endl;
}
int main()
{
     int a = 20, b = 30, c = 40;
     cout << "a = " << a << ", b = " << b << ", c = " << c << endl;
     fun(a,b,c);
     cout << "a = " << a << ", b = " << b << ", c = " << c << endl;
     fun(2*a-3,b,c);  
     cout << "a = " << a << ", b = " << b << ", c = " << c << endl;
     return 0;
}
【案例5-14】成员函数的选择调用——常成员函数
#include<iostream>
using namespace std;
class ZRF
{
public:
     ZRF(int Z1, int Z2){ZRF1=Z1;ZRF2=Z2;}
     void disp();
     void disp() const;                           //常成员函数声明
private:
     int ZRF1,ZRF2;
};
void ZRF::disp()  
{
     cout<<ZRF1<<":"<<ZRF2<<endl;
}
void ZRF::disp() const      //常成员函数定义
{
cout<<ZRF1<<":"<<ZRF2<<endl;
}
int main()
{
     ZRF a(2,3);
     a.disp();                                    //调用void disp()
     const ZRF b(10,20);   
     b.disp();                                    //调用void disp() const
return 0;
}
【案例5-15】计算圆周长——不带参数的宏定义
#include<iostream>           
using namespace std;
#define PI 3.14159                         //宏名PI为符号常量
#define n a                                  //宏名n将用a来替换
#define LENGTH  2*PI*n                      // 宏名LENGTH将用2*PI*n来替换
int main()
{
     int n=1;                              //int n=1;替换为int a=1;
     cout<<"LENGTH="<<LENGTH<<endl;        //替换为cout<<"LENGTH="<<2*3.14159*a<<endl;  


unto非常好用的准夸网自动信息发布软件next同时C语言的汇编原来就是这么简单几行代码可以读取出来
回复

使用道具 举报

0

主题

649

帖子

639

积分

积分
639
信息发布软件沙发
发表于 2017-6-27 14:25:05 | 只看该作者
这次合作,整个过程很顺利,今后我的店铺还是会请你帮我装修,希望越来越好

回复 支持 反对

使用道具 举报

1

主题

2204

帖子

565

积分

积分
565
推广工具板凳
发表于 2017-6-30 12:28:41 | 只看该作者
用,和卖家介绍的一样,操作简单,一学就会,满意。

回复 支持 反对

使用道具 举报

0

主题

608

帖子

616

积分

积分
616
软件定制开发地板
发表于 2017-7-2 11:56:56 | 只看该作者
很厉害,5分钟就带我搞完了,很满意!客服态度也很好,以后有需要,还会找你们

回复 支持 反对

使用道具 举报

0

主题

594

帖子

586

积分

积分
586
5#定制软件#
发表于 2017-7-9 13:27:27 | 只看该作者
不错不错,您辛苦了。。。

回复 支持 反对

使用道具 举报

0

主题

648

帖子

632

积分

积分
632
6#定制软件#
发表于 2017-7-13 02:23:52 | 只看该作者
小手一抖,钱钱到手!

回复 支持 反对

使用道具 举报

1

主题

2204

帖子

565

积分

积分
565
7#定制软件#
发表于 2017-7-13 06:05:46 | 只看该作者
事情好垃圾的

回复 支持 反对

使用道具 举报

0

主题

1002

帖子

1010

积分

积分
1010
8#定制软件#
发表于 2017-7-13 06:26:14 | 只看该作者
好很喜欢

回复 支持 反对

使用道具 举报

0

主题

606

帖子

599

积分

积分
599
9#定制软件#
发表于 2017-7-13 07:05:48 | 只看该作者
大气漂亮,全5星好评,已经合作好几次了,非常不错.

回复 支持 反对

使用道具 举报

0

主题

602

帖子

594

积分

积分
594
10#定制软件#
发表于 2017-7-20 03:52:06 | 只看该作者
码,卖家发货也很快,5分好评!

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

相关导读
信息发布软件AIWROK软件苹果IOS里如何启动其他APP?
原理ios的快捷指令可以接收参数我们可以用命令 app.openApp("微信") 来启动微信但是这个指令有两个权限要求第一需要通过快捷指令第二需要aiwork在前端不能在后台 第一步先创建快捷指令如何创建?方案一搜索快捷指令app并打开 点击+号,选打开app 长按这个App文字 这样就创建好打开app并且能接受参数的快捷指令了方案2 直接扫码安装快捷指令 注意到这里还没完因为 使用 命令必须让aiwork在前端,所以必须配置自启动 让执行命令的时
信息发布软件AIWROK软件完整的例子脚本分享1
AIWROK软件完整的例子脚本分享1 https://www.yuque.com/aiwork/nba2pr/mf8wfx4tw5ct3rf2 这里下载附件 这段代码是一个使用AutoApp安卓自动化IDE编写的脚本,主要用于自动化操作名为“红果短视频”的应用程序。脚本的主要功能包括登录应用、播放视频、领取奖励和签到等操作。以下是对代码的详细说明: [*]注释说明: [*]代码开头是一些注释,提供了使用说明以及相关的帮助文档、官方地址和QQ群信息。 [*]引入外部脚本
信息发布软件&#127800;AIWROK软件悬浮窗自定义启停
🌸AIWROK软件悬浮窗自定义启停 这段代码是使用 AIWROK 编写的,一个基于JavaScript的自动化工具,可以用于Android设备上的自动化操作。代码的主要功能是创建一个悬浮窗,悬浮窗上包含两个按钮:“启动”和“关闭”。这两个按钮的功能分别是启动和停止一个后台线程,以及关闭所有运行的任务。代码详细说明如下: [*]创建一个悬浮窗对象 f,使用 new floatUI() 来初始化。 [*]定义变量 t,用于存储线程对象。 [*]使用 loa
信息发布软件AIWROK软件里opencv.findImages找到目标如何打印出来座标呢
安卓的方法:opencv.findImages找到目标如何打印出来座标呢这段代码的主要功能是在一个特定的屏幕上查找并点击一个目标图像。下面是对代码的详细解释: [*]定义屏幕尺寸: var SCREEN_WIDTH = 750;var SCREEN_HEIGHT = 1334; 这两行代码定义了屏幕的宽度和高度,分别为750像素和1334像素。 [*]打印日志: printl('图色232783'); 这行代码打印一条字符串“图色232783”到日志中。需要注意的是,这里使用了printl,在标准的Jav
信息发布软件aiwrok软件屏幕点亮和屏幕息屏的命令无障碍模式
aiwrok软件屏幕点亮和屏幕息屏的命令无障碍模式 [*]导入类:导入PowerManager类。 [*]获取电源管理服务:通过context.getSystemService获取电源管理服务。 [*]创建唤醒锁:创建一个可以唤醒设备并点亮屏幕的唤醒锁。 [*]定义唤醒屏幕函数:创建一个函数wakeScreen,用于唤醒屏幕。 [*]定义释放唤醒锁函数:创建一个函数releaseWakeLock,用于释放唤醒锁。 [*]示例调用:展示如何调用这两个函数来唤醒屏幕并随后释放唤醒
信息发布软件AIWROK软件自定义Activity页面背景图片
AIWROK软件自定义Activity页面背景图片 [*]var ac = new activity();:这行代码创建了一个新的Activity对象。Activity是Android应用的基本构建块之一,通常代表一个单一的屏幕。 [*]ac.loadXML(...):这里通过加载一段XML布局代码来初始化Activity的布局。XML布局代码描述了用户界面的结构和外观。在这个例子中,使用了一个垂直方向的LinearLayout作为根布局,其中包含一个Button。 [*]var view = ac.findViewById("bg"):
信息发布软件opencv原生模板找图转座标方法
这段代码是使用OpenCV库进行图像匹配的JavaScript代码示例。它的主要功能是在一个较大的图像中查找一个小图像的位置。以下是代码的详细说明: [*]导入OpenCV库: [*]importClass(org.opencv.imgproc.Imgproc):导入图像处理类Imgproc,该类包含了图像模板匹配的方法。 [*]importClass(org.opencv.imgcodecs.Imgcodecs):导入图像编码解码类Imgcodecs,该类用于读取和写入图像文件,以及将字节数组转换为Mat对象。 [*]impor
信息发布软件hui动态生成复选框显示所有app
// 官方QQ群 711841924function getChcek1() { var check1 = { id: "check_c16291c6", type: "check", style: { width: "300", height: "auto", position: "absolute", top: 122, left: 103, right: "", bottom: "", borderWidth: "0", borderColor: "", borderStyle: "none",
信息发布软件AIWROK软件随机范围点击随机范围拖动
AIWROK软件随机范围点击随机范围拖动 1. 随机位置点击[/backcolor] 函数 [*]功能:在指定的百分比坐标附近随机点击。 [*]参数: [*]x[/backcolor]:点击位置的百分比 X 坐标。 [*]y[/backcolor]:点击位置的百分比 Y 坐标。 [*]x范围[/backcolor]:X 坐标的随机范围。 [*]y范围[/backcolor]:Y 坐标的随机范围。 [*]实现: [*]首先将百分比坐标转换为实际屏幕坐标。 [*]然后在指定范围内生成新的随机坐标。 [
信息发布软件AIWROK软件里的PaddLeOCR里的OCR
这里有第一种方法:这里带第二种方法:
信息发布软件AIWROK软件YOLO找色判断两个页面是否一样
这段代码常用于自动化测试、监控屏幕内容变化或者实现某些特定的自动化操作,比如在等待某个界面加载完成时,通过检测特定区域的颜色变化来判断页面是否已经加载完毕。// 获取当前屏幕的全屏截图,并保存为/sdcard/1.jpg var img = screen.screenShotFull(); img.save('/sdcard/1.jpg'); // 获取截图中某个特定点的RGB值(此处坐标为屏幕宽度的82.2%,屏幕高度的64.27%) var rgb = img.getPointRGB(0.822, 0.6427);
信息发布软件在AIWROK软件中loadDex 加载插件
说明:可以使用安卓studio 开发出apk,jar,或者dex使用此方法加载模块,注意:插件直接放到插件文件夹中然后上传到手机英文方法: loadDex(plugin),加载插件到系统参数:plugin:插件名称例如导入的插件为 p1.dex,则参数名就填写 loadPlugin(‘p1.dex’)案例://导入dex模块 rhino.loadDex('p1.dex') //导入apk模块 rhino.loadDex('demo.apk')importClass 导入插件中的类方法说明:通过这个方法可以导入插件里编写好的类英文方法:imp
信息发布软件rhino犀牛Java交互AIWROK应用
Java交互简介:AutoApp 提供了 Java交互API,比如导入Java包、类。1.如何让java代码转成js代码例如:我们想要通过java代码获取手机的像素javaDisplayMetrics dm = context.getResources().getDisplayMetrics(); int screenWidth = dm.widthPixels; int screenHeight = dm.heightPixels;在js代码中变量不需要声明,比如 dm是一个 DisplayMetrics类型 js中直接使用 let 或者 var即可js代码var dm = context.getResources().getDisplay
信息发布软件HID如何开启节点功能呢?
HID如何开启节点功能呢?第一步,HID 连接上好后,灯是快闪的,连上了才可以节点,这要注意一下,打开 APP 图标点击一下打开这个侧栏图标,弹出左边这个主软件界面,这里有很多功能,如下图所示: 第二步是点开 HID 硬件这个按钮侧栏,要 3.36 才有这个功能的,以前的版本没有,这个也要 168 个人会员以上才能用的功能,这个 APP 最新的版本 3.38 可以对部分的自绘界面进行节点操作,有的不规则面页是比较难有节点出现的,有部分
信息发布软件AIWORK软件获取当前所有线程指定停止
getAllThreads 函数用于获取当前Java虚拟机中所有活动线程的信息。它通过获取当前线程的线程组,然后不断向上遍历,直到找到根线程组。接着,利用 enumerate 方法将所有线程枚举到一个数组中,并返回这个数组。 getThreadNames 函数调用 getAllThreads 函数获取所有线程对象后,使用 map 方法提取每个线程的名称,形成一个新的数组并返回。这个数组包含了所有活动线程的名称。 stopThread 函数用于尝试终止指定名称的线程。它
信息发布软件苹果IOS配置读写怎么实现的呢?
// 创建一个单选按钮组,用于管理性别选择的单选按钮let rg = new RadioButtonGroup();// 从配置中获取性别值,如果配置中没有性别值,则默认为空字符串let sexvalue = config.getConfig("sex", "");// 创建一个输入框,用于用户输入其他信息(例如用户名)let user = new Input();// 创建一个单选按钮,表示男性选项let nan = new RadioButton();nan.setText("男"); // 设置单选按钮的文本为“男”if (sexvalue === "男") { na
信息发布软件okHttp实例判断一下网址打不开的方法
// 创建 okHttp 实例var http = new okHttp();http.setHeader("User-Agent", "Mozilla/5.0");var url = "http://www.baidu.com/";try { printl("开始发送 GET 请求到: " + url); var result = http.get(url); printl("请求完成,响应对象: " + JSON.stringify(result)); // 打印完整的响应对象 if (result && result.code !== undefined) { printl("请求成功,状态码: " + result.code); if (result
信息发布软件AIWROK软件内容匹配 match()函数用来查找字符串中特定的字符
内容匹配 match()函数用来查找字符串中特定的字符function findSubstringInString(mainStr, pattern) { // 使用 match() 查找给定的模式 var result = mainStr.match(pattern); if (result !== null) { // 如果找到了匹配项,则返回匹配的结果 return "Match found: " + result[0]; } else { // 如果没有找到匹配项,则返回相应的消息 return "No match found."; }}// 定义字符串和要
信息发布软件&#127800;用AIWROK软件游戏选项执行不选择项随机执行怎么弄?
🌸用AIWROK软件游戏选项执行不选择项随机执行怎么弄?// 群号711841924function 游戏选项执行(易玩游戏选择) { // 随机选择一个元素 var 随机索引 = Math.floor(Math.random() * 易玩游戏选择.length); var 随机字符 = 易玩游戏选择[随机索引]; // 检查易玩游戏选择和随机字符的组合,执行相应游戏 if (易玩游戏选择.indexOf('美女泡泡大战') !== -1 && 随机字符 === '美女泡泡大战') { printl('
信息发布软件实用型多线程脚本运行20秒后停止
本帖最后由 信息发布软件 于 2025-5-15 06:28 编辑 var threads = [];function 计划任务(函数, 运行时间){    var t = new thread();    threads.push(t);    t.runJsCode( () => {        函数();    }, "计划任务")    sleep.second(运行时间);    t.stop();}function 脚本1(){    while(true){     &n
信息发布软件分享苹果UI里的AIWROK一个完整的界面
分享苹果UI里的AIWROK一个完整的界面// 群号711841924// 创建 TabViewvar tab = new TabView();// 设置标签页标题tab.setTitles(["首页", "第二页", "第三页", "第四页"]);// 显示 TabView,并在加载完成后执行回调函数tab.show(() => { printl("TabView 显示完成"); // 添加每个标签页的视图 tab.addView(0, h1()); // 首页 tab.addView(1, h2()); // 第二页 tab.addView(2, h3()); // 第三页 tab.addView(3,
信息发布软件AIWROK软件手机短信采集按需采集
/* 这个是获取手机短信的例子, 最近很多人用AIWORK怎么获取短信验证码,这样就不用去打开,然后一点一点的采集了。 其实AIwork是有很便捷的方式进验证码采集的,比如下面这段,按时间排序的短信验证码,这样就可以采集出验证码, 并且可以全部输入数字出来,有哪位朋友需要这段代码的请加群或是加我Q获取这段现成的代码。 下面是AIWORK演示代码操作:*/// 定义一个函数,用于读取最新的短信function readLatestSms() { //
信息发布软件HID键鼠其它功能设备如关充电开充电息屏亮屏
hid.keyPress(0,keycode.A());//在光标后面输入aa//方法1hid.keyPress(0,keycode.Enter());//亮屏//方法2hid.keyPress(0,0x07);//唤醒屏亮屏hid.keyPress(0,0x66);//息屏,关屏键盘设备Android 支持各种键盘设备,包括特殊功能小键盘(音量和电源控制),紧凑型嵌入式 QWERTY 键盘和全能型 PC 式外接键盘。本文档仅介绍物理键盘。有关软键盘(输入法编辑器)的信息,请参阅 Android SDK。键盘分类只要满足以下任一条件,输入设备即
信息发布软件AIWROK软件定义手势路径构造函数
AIWROK软件定义手势路径构造函数// 定义手势路径构造函数function GesturePath() { this.points = []; this.duration = 0;}// 设置持续时间的方法GesturePath.prototype.setDurTime = function(duration) { this.duration = duration;};// 添加点的方法GesturePath.prototype.addPoint = function(x, y) { this.points.push({ x: x, y: y });};// 定义多手指手势构造函数function MultiFingerGesture() { this.fing
信息发布软件用AIWROK软件排除打叉关闭区域并让它点击我想点的关闭怎么弄?
function 点击区域跳过检测(left, top, right, bottom) { var leftPercent = left; var topPercent = top; var rightPercent = right; var bottomPercent = bottom; // 获取屏幕的宽度和高度 var screenWidth = screen.getScreenWidth(); var screenHeight = screen.getScreenHeight(); // 计算矩形区域的坐标 var x1 = screenWidth * leftPercent; var y1 = screenHeight * topPercent; var x2
群发软件AIWROK软件生成随机时间函数妙用技术方法
/** * 生成随机时间函数 * @returns {string} 格式为HH:MM:SS的随机时间字符串 */function 随机时间() { // 生成随机小时、分钟和秒数 var hours = Math.floor(Math.random() * 24); var minutes = Math.floor(Math.random() * 60); var seconds = Math.floor(Math.random() * 60); // 格式化时间为两位数 hours = hours < 10 ? '0' + hours : hours; minutes = minutes < 10 ? '0' + minutes : minutes;
群发软件AIWROK软件如何使用webview 实现 h5界面ui
var web = new WebView()web.show();web.loadHtml(`<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>WKWebView JS to Swift</title> <style> body { font-family: -apple-system, BlinkMacSystemFont, sans-serif; padding: 40px; background-color: #f2f2f7; text-align: center; } button {
群发软件AIWROK软件如何训练自己的数据集
通用yolo模型aiwork平台提供了通用yolov5插件,可以自行下载开源训练库或者把你已经训练好的yolov5模型转成.tflite格式即可使用调用案例:复制var yolo=new yoloV5(); //可以自己配置是否gpu加速和int8量化 yolo.loadTFMode("/插件/fp16_320.tflite","/插件/YoloV5.txt",320,false,false,false); //或者简写 //yolo.loadTFMode("/插件/fp16_320.tflite","/插件/YoloV5.txt",640); //本地图片识别 var img=new image().readT
群发软件AIWROK常用的随机位置范围点击随机拖动
/* * 随机位置点击函数 * @param {number} x - 点击位置的百分比 X 坐标 * @param {number} y - 点击位置的百分比 Y 坐标 * @param {number} x范围 - X 坐标的随机范围 * @param {number} y范围 - Y 坐标的随机范围 */function 随机位置点击(x, y, x范围, y范围) { // 将百分比坐标转成真实坐标 var x1 = screen.percentToWidth(x); var y1 = screen.percentToHeight(y); // 在指定范围内生成新的随机坐标 x1 = ran
群发软件AIWROK软件FTP完整例子自动链接可以上传可以下载
AIWROK软件FTP完整例子自动链接可以上传可以下载/* 欢迎使用AiWork安卓自动化IDE qq群: 711841924 */// 加载FTP库rhino.loadDex(project.getResourcesPath() + "ftp.dex");importClass(org.apache.commons.net.ftp.FTP);importClass(org.apache.commons.net.ftp.FTPClient);importPackage(java.io);// FTP配置参数var ftpHost = "154.201.80.249";var ftpPort = 21;var username = "rtyerye";var password = "8AafKDs4KhMDR3yy
群发软件AIWROK真正能包打天下的三种查找随机方法
AIWROK真正能包打天下的三种查找随机方法// 图片文字识别相关方法// 使用opencv的OCR进行文字识别并随机点击function 找字随机点击() { var ocr = opencv.OCREx('今日头条极速版8.cv'); if(!ocr) return; var target = ocr.findIncludeText('今日头条极速版'); if(target) { var rect = target.rect; var screenWidth = screen.getScreenWidth(); var screenHeight = screen.getScreenHeight
群发软件AIWROK软件技巧分享图片二值化封装使用
AIWROK软件技巧分享图片二值化封装使用// 引入 Android 和 OpenCV 的类importPackage(org.opencv.core);importPackage(org.opencv.imgproc);importPackage(org.opencv.android);importClass(android.graphics.Bitmap);function screenshotAndBinarize(width, height, quality, threshold1, threshold2) { // 进行屏幕截图 var bitmap = screen.screenShot(width, height, quality).getBitmap(); // 将 Bitmap 转换为 Open
群发软件AIWROK软件安卓自动化auto__小结方法总汇集
第一个:back按下回退键auto.back();这个代码示例展示了如何调用一个名为 back() 的函数来返回上一页或执行某种“返回”操作。例子:function demoExample() { // 打印信息表明即将返回上一页 printl("即将返回上一页"); // 使用 auto.back() 返回上一页 auto.back(); } // 调用示例函数 demoExample();代码说明:function demoExample() { ... }:定义了一个名为 demoExample 的函数,该函数没有参数。printl("
群发软件floatUI自定义极度美化悬浮窗
/* 欢迎使用AiWork安卓自动化IDE 帮助文档: http://help.autoapp.net.cn 官方地址: www.aiwork24.com qq群: 743723025*/ // 定义一个名为悬浮窗的构造函数function 悬浮窗() {}// 创建一个悬浮窗实例var float = new 悬浮窗()// 定义一个全局变量用于控制停止状态var 全局_停止 = false// 为悬浮窗构造函数的原型添加create方法,用于创建悬浮窗界面悬浮窗.prototype.create = function () { // 创建一个floatUI实例,f
群发软件AIWROK软件agent代理模式ADB方法集合
第一个例子:开启代理模式判断agent.start()agent.start() 函数用于开启代理模式,需 root 权限,无需参数。此函数执行后会返回一个布尔值:如果成功返回 true,否则返回 false。下面是一个可能的使用例子:// 尝试启动代理模式 let result =agent.start(); printl(result); if (result) { console.log("代理启动成功!"); } else { console.log("代理启动失败,请检查是否具有root权限。"); }此代码尝试启动代理模式,
群发软件用在AIWORK软件代码中的实用符号分类整理
var 任务进行中 = true;var 倒计时已启动 = false;var 任务三已执行 = false;var 任务一定时器, 任务二定时器;function 任务一() { print.log("🚀▶️ 准备执行任务一"); // 使用您的环境专用输出 function 执行任务一() { if (!任务进行中) { clearTimeout(任务一定时器); return; } print.log("✅🔁 任务一执行中..."); 任务一定时器 =
群发软件AIWROK多线程方法UI线程对象方法
AIWROK多线程方法UI线程对象方法名称new thread()作用多线程方法权限root键鼠无障碍语法new thread()参数类型是/否说明线程对象对象是创建一个线程对象返回类型是/否说明对象/对象成功对象失败函数线程对象方法类型是/否说明.runJsCode(fun, name )函数/字符是fun 执行的函数name 执行线程名称返回类型是/否说明无无成功失败文件线程对象方法类型是/否说明. runJsFile (js, name )字符是js 执行的js文件name 执行线程名称返回类型
群发软件AIWROK软件常用数组方法小结汇集方法
/* 官方交流群号711841924 *//* 安卓手机 Android 和Rhino1.7.13 和ES5 JavaScript环境 */var 数组 = {};// 1. 元素升序(小到大)数组.元素升序 = function(arr) { try { if (!Array.isArray(arr)) throw new Error("需要数组"); return arr.slice().sort(function(a,b){return a-b;}); } catch(e) { printl("[错误] "+e.message); return null; }};// 2. 元素降序(大到小) 数组.元素降
群发软件AIWROK软件多线程thread1.runJsFile例子
本帖最后由 群发软件 于 2025-4-15 09:24 编辑 T = time.nowStamp();// 正确启动两个线程(线程名必须不同!)var thread1 = new thread(); // 线程对象1var thread2 = new thread(); // 线程对象2thread1.runJsFile('线程1.js', 'worker1'); // 线程名用"worker1" thread2.runJsFile('线程2.js', 'worker2'); // 线程名用"worker2"// 监控循环(10秒后停止线程1)while (true) { printl("正常运行"); sleep.millisecon
群发软件AIWROK软件支持的Java标准库和Android SDK库
特别是针对Android开发时导入的各种类。这些类分别属于Java标准库和Android SDK库,用于处理不同的功能需求。下面是对这些代码的详细说明://java类//importClass(java.math.Session);//importClass(java.math.Transport);//importClass(java.math.BigInteger);//importClass(java.math.internet.MimeMessage);importClass(java.sql.Connection);importClass(java.sql.DriverManager);importClass(java.sql.ResultSet);importClass
群发软件AIWROK软件thread使用全局变量控制线程状态
AIWROK软件thread使用全局变量控制线程状态// 安卓手机 Android 和Rhino1.7.13 和ES5 JavaScript环境// Android 环境 Rhinoceros 引擎与 JavaScript 的多线程示例{ // 使用全局变量控制线程状态 var shouldStop = false; // 创建一个 Java 的 Thread 对象 var runnable = new java.lang.Runnable({ run: function() { var count = 0; while (!shouldStop) {
群发软件AIWROK软件HID点击方法的方法集合小结
// 点击坐标// boolean click(int x, int y) 返回值: boolean// 参数: int x: 横坐标 int y: 纵坐标// 案例: hid.click(0, 0)hid.click(0, 0)// 点击百分比坐标// void clickPercent(double arg0, double arg1) 返回值: void// 参数: double arg0: 横坐标 double arg1: 纵坐标// 案例: hid.clickPercent(0, 0)hid.clickPercent(0, 0)// 连续点击// boolean clicks(int x, int y, int times, int delay) 返回值: boolean// 参数: in
群发软件AIWROK软件常用OKHTTP方法小结汇集
群发软件AIWROK软件字符方法集合小结
//字符.分割字符/** * 字符串分割工具模块 - 修正版 * 最后更新:2025-04-02 */var 字符 = { /** * 字符串分割方法 * @param {string} str 要分割的字符串 * @param {string} divide 分隔符 * @returns {Array|null} 分割后的数组或null(错误时) */ 分割字符: function(str, divide) { try { if (typeof str !== 'string') return null; if (typeof divide !== 'string')
群发软件AIWROK软件数学方法集合小结
/** * //适用本文档ES5系统安卓 JavaScript引擎Rhino * 数学方法全集 * 运行环境: Android + Rhino 1.7.13 + ES5 */// 定义数学对象var 数学 = {};/** * 二为底的e的对数 * @setting ROOT 代理激活 无障碍 键鼠硬件 * @returns {number} 返回二为底的e的对数 */数学.__二为底的e的对数 = function() { return Math.LOG2E;};/** * 二的平方根 * @setting ROOT 代理激活 无障碍 键鼠硬件 * @returns {number} 返回二的平方根 */数
群发软件AIWROK软件应用方法集合小结
// 应用管理工具集const 应用 = {};// 模拟日志函数const LOG = { info: function(msg) { printl(' ' + msg); }, err: function(msg) { printl('[ERROR] ' + msg); }};/** * 停止当前脚本 */应用.停止脚本 = function () { try { LOG.info("尝试停止脚本..."); if (typeof runtime !== 'undefined' && runtime.exit) { LOG.info("使用runtime.exit()停止脚本"); runtime.exit();
群发软件AIWROK软件常见正则方法集合小结
//适用本文档ES5系统安卓 JavaScript引擎Rhinoconst 字符 = { /** * 匹配查找字符串中的内容 * @param {string} str 需要查找的字符串 * @param {string|RegExp} searchvalue 需要查找的字符串或正则表达式 * @returns {Array|null} 成功:返回包含匹配结果的数组,失败:返回null * @example * // 示例1:查找字符串 * var str = "How are you doing you today?"; * var fgh = 字符.匹配查找(str
群发软件AIWORK类语聊智能聊天机器人带意图识别例子演示
类语聊智能聊天机器人带意图识别例子演示 飞桨智能聊天机器人集成指南示例代码转换为实际可用的智能聊天机器人应用。1. 代码结构说明当前代码包含两个主要模块:HTTP工具模块提供基础的HTTP请求功能,用于与飞桨API进行通信: [*]HTTP工具.创建请求() - 创建HTTP请求实例 [*]HTTP工具.设置请求头(http, headers) - 设置HTTP请求头 [*]HTTP工具.POST请求(url, data, headers) - 发送POST请求并处理响应 智能聊天机器人模块实现
群发软件AIWROK软件时间方法集合小结
AIWROK软件时间方法集合小结//适用本文档ES5系统安卓 JavaScript引擎Rhinoconst 时间 = { /** * 获取当前时间戳 * @returns {number} 返回当前的时间戳(毫秒) * @example * var timestamp = 时间.当前时间戳(); * printl(timestamp); // 输出类似: 1677649423000 */ 当前时间戳: function() { return Date.now(); }, /** * 格式化时间为指定格式 * @param {Date|number|str
群发软件IOS苹果TabView视图和Horizontal水平布局控件
IOS苹果TabView视图和Horizontal水平布局控件 导航条视图模式可以支持多个页面标签切换案例:创建TAB视图显示视图function show(function fun)参数 func :ui显示以后调用的方法设置tabtab.setTitles(["首页", "关于", "我的"])//关闭视图tab.dismiss()添加子视图tab.addView(tabindex,view)参数tabindex:tab的序号从0开始参数 view:子视图案例Horizontal水平布局控件用于横向放置多个控件案例:
群发软件苹果熟悉layout线性布局和IOS苹果View视图
本帖最后由 群发软件 于 2025-3-27 07:34 编辑 线性布局是垂直或者水平布局类似网格 水平布局 比如就是一行可以放多个控件文本框:按钮:单选框:复选框类似上面这样一行可以放多个控件的就是水平布局垂直布局就是一行只能放一个元素文本框按钮单选复选混合布局,就是水平和垂直嵌套就可以实现复杂的界面例如一个登录界面,先创建一个垂直布局 ,每个垂直布局的每一行再放一个水平布局用户名————————密码————————
群发软件AIWROK软件生成椭圆曲线手势
这段代码定义了一些用于生成和执行贝塞尔曲线手势的函数。具体来说,代码分为以下几个部分: 1随机数生成函数: 这个函数 random(a, b) 使用 rand.randNumber(a, b) 来生成一个在 a 到 b 之间的随机数。不过,在完整的代码中,rand.randNumber 需要是一个已定义的函数或库方法。 2椭圆曲线点生成器: 函数 generateEllipticPoints(a, b, xStart, xEnd, step) 用于根据椭圆曲线的参数 a 和 b,在指定的 x 范围内生成一系列的点。
群发软件AIWROK软件屏幕自动化操作方法汇集
代码的简要说明和一些注意事项: [*]MLKitOcr 文字识别: [*]代码中使用了 MLKitOcr 方法来进行文字识别。'zhs' 和 'zh' 都是中文的识别代码,但通常使用 'zh'。 [*]识别结果通过 getAllString() 方法获取,然后打印出来。 [*]使用完截图后,记得调用 recycle() 方法来释放资源。 [*]截图并压缩: [*]使用 screenShot 方法可以指定截图的尺寸和压缩质量。 [*]检查截图是否成功后再进行后续操作。 [*]计算面
群发软件苹果IOS在IDE中配置AIWork直播插件的详细图文教程
在IDE中配置AIWork直播插件的详细图文教程以下是关于在集成开发环境(IDE)中配置AIWork直播插件的详细步骤说明,帮助您顺利完成设置。第一步:安装IDE1. 下载并安装IDE· 下载安装包:访问官方网站或可信来源下载最新版本的IDE安装包。· 安装步骤:a. 双击安装包文件,按照提示完成安装。b. 安装完成后,重启计算机以确保环境变量生效。· 验证安装:打开IDE,检查是否能正常运行,确保所有组
群发软件AIwok软件苹果IOS手机初始化设置和IOS HTTP接口
配置要求:IDE AIWORK >3.25手机 >= iphone6sIOS版本 >=IOS15(ios15不支持画中画日志,16以上支持)苹果HID硬件必须设置:自动息屏:必须关闭,不然截屏权限会自动关闭蓝牙:必须打开辅助触控:必须打开 (设置->辅助功能->触控->辅助触控->打开)软件安装1.下载tf并安装https://testflight.apple.com/join/1sVURYPb或者扫二维码下载 安装完tf以后 再安装aiwork初始化第一步 硬件连接手机,选择硬件第二步 开启辅助触
群发软件AIWROK软件多线程协作示例代码解析
AIWROK软件多线程协作示例代码解析 详细说明 [*]线程对象创建 [*]使用new thread()创建两个独立线程对象 [*]dataThread用于数据处理,logThread用于日志记录 [*]每个线程有独立的执行上下文和生命周期 [*]数据生成线程 [*]通过runJsCode方法执行匿名函数 [*]使用for循环生成1-5的序列数据 [*]java.lang.Thread.sleep(1000)实现1秒间隔(Rhino引擎特性) [*]线程命名为"数据线程"便于调试识别 [*]日志记录线程
群发软件AiWork软件下载蓝奏云OCR文件到文件夹
这段代码是一个用于从蓝奏云(Lanzou)下载文件的自动化工具脚本,主要基于JavaScript编写,并且是在一个安卓自动化环境中运行的,例如使用AiWork这样的自动化IDE。代码中定义了一个主要的函数downloadLanzouFile,它接受三个参数:文件的URL地址url,保存文件的路径saveFilePath,以及最大重试次数maxRetries(如果未提供,函数默认设置为5次)。代码的主要功能和步骤如下: [*]初始化和配置: [*]定义了蓝奏云的备用域
群发软件setTimeout__方法异步延迟加载函数
这段代码定义了一个简单的任务链,模拟了一个从数据查询到数据处理再到数据保存的流程。代码中使用了runTime.setTimeout来模拟每个任务的执行耗时。以下是代码的详细说明: [*]taskOne函数:这是第一个任务,负责开始数据查询。 [*]使用printl函数打印一条消息,表示任务一即将开始。 [*]使用runTime.setTimeout函数来模拟数据查询的过程,设置的延迟时间为3秒(3000毫秒)。 [*]在3秒后,生成一个模拟数据字符串"查
群发软件floatUI悬浮窗 实用示例合集
floatUI悬浮窗 实用示例合集如何使用 floatUI 创建不同的 UI 组件,并为它们设置点击事件。每个示例都展示了不同的 UI 布局和事件处理逻辑。示例 1: 创建一个带有多个按钮的垂直布局,并为每个按钮设置不同的点击事件var f1 = new floatUI(); f1.loadSXML(` <vertical> <button text="按钮1" id="button1"/> <button text="按钮2" id="button2"/> <button text="按钮3"
群发软件AIWROK软件找图__方法小汇集
方法一:定义图像查找函数 [*]功能:在指定的查找区域内查找与模板图像相似度达到设定值的目标,并自动点击该目标的中心位置。 [*]参数: [*]searchRegion:查找区域的相对坐标,格式为 [x1, y1, x2, y2],其中 (x1, y1) 是左上角坐标,(x2, y2) 是右下角坐标。 [*]templateImage:模板图像的Base64编码字符串。 [*]similarity:相似度阈值,用于判断是否匹配。 [*]流程: [*]获取屏幕截图并转换为Mat格
群发软件awirok软件找色__方法小汇集
群发软件AIWORK 软件全功能 OCR 查找区域功能代码示例
    // 第一个示例:获取屏幕截图并进行 OCR 文字识别(简体中文)var img1 = screen.screenShotFull();var ocr1 = img1.MLKitOcr('zhs');var text1 = ocr1.getAllString();printl(text1);img1.recycle();/*说明:- 这是一个最基本的 OCR 示例。- 使用 MLKitOcr 方法通过简体中文词库识别截图中的文字。- 最终输出识别到的全文本信息。*/// 第二个示例:指定区域内的 OCR 文字识别(中文)var img2 = screen.s
群发软件AiWROK软件里的OpenCV图片分辨率压缩和质量压缩
// 导入必要的Android和OpenCV类importClass(android.graphics.Bitmap);importClass(java.io.File);importClass(org.opencv.core.Core);importClass(org.opencv.core.Mat);importClass(org.opencv.core.Size);importClass(org.opencv.imgproc.Imgproc);// 全屏截图var img = screen.screenShotFull();if (img.isNull()) {printl("截图失败");exit();}// 原始图片信息var originalPath = "/sdcard/original.jpg";img.save(originalP
群发软件定时任务示例:使用 setInterval 和 clearInterval 实现多种功能
1. 倒计时功能var countdownTime = 10; var countdownInterval; function updateCountdown() { if (countdownTime > 0) { console.log("剩余时间: " + countdownTime + "秒"); countdownTime--; } else { clearInterval(countdownInterval); console.log("倒计时结束!"); } }用法启动:startCountdown()停止:stopCountdown()应用场景游戏倒计时、会议提醒、考试计时、烹饪计时等。2. 实时时
群发软件AIWORK软件将数组↔互转字符串
AIWORK软件将数组↔互转字符串1.方法将数组转换为字符串// 定义函数function myFunction() {// 定义一个包含水果名称的数组var fruits = ["Banana", "Orange", "Apple", "Mango"];console.log("原始数组: ", fruits);// 使用 toString 方法将数组转换为字符串var str = fruits.toString();console.log("转换后的字符串: ", str);// 返回转换后的字符串return str;}// 调用函数var result = myFunction();2. 将数组互转字符串/

QQ|( 京ICP备09078825号 )

本网站信息发布软件,是可以发布论坛,发送信息到各大博客,各大b2b软件自动发布,好不夸张的说:只要手工能发在电脑打开IE能发的网站,用这个宣传软件就可以仿制动作,进行推送发到您想发送的B2B网站或是信息发布平台上,不管是后台,还是前台,都可以进行最方便的广告发布,这个广告发布软件,可以按月购买,还可以试用软件,对网站的验证码也可以完全自动对信息发布,让客户自动找上门,使企业轻松实现b2b发布,这个信息发布软件,均是本站原创正版开发,拥有正版的血统,想要新功能,欢迎提意见给我,一好的分类信息群发软件在手,舍我其谁。QQ896757558

GMT+8, 2025-6-16 18:12 , Processed in 0.326665 second(s), 54 queries .

宣传软件--信息发布软件--b2b软件广告发布软件

快速回复 返回顶部 返回列表