当前位置: 首页 > wzjs >正文

哪些公司需要网站开发工程师局域网网站建设工具

哪些公司需要网站开发工程师,局域网网站建设工具,汕头市网络优化推广平台,wordpress网站修改域名1、 重载求最大值函数(zlh) 定义重载函数maxinum,分别求三个整数、三个浮点数和三个字符中最大的一个并输出。 输入样例1:45 67 100 34 2.3 78.2 a A B 输出样例1:100 78.2 a 输入样例2:0 1 2 2.3 3.4 8…

1、 重载求最大值函数(zlh)

定义重载函数maxinum,分别求三个整数、三个浮点数和三个字符中最大的一个并输出。

输入样例1:45 67 100 34 2.3 78.2 a A B
输出样例1:100 78.2 a

输入样例2:0 1 2 2.3 3.4 8.0 d r z
输出样例2:2 8.0 z

//重载求最大值函数(zlh)
//定义重载函数maxinum,分别求三个整数、三个浮点数和三个字符中最大的一个并输出。
//
//输入样例1:45 67 100 34 2.3 78.2 a A B
//输出样例1:100 78.2 a
//
//输入样例2:0 1 2 2.3 3.4 8.0 d r z
//输出样例2:2 8.0 z#include <iostream>
using namespace std;
int maxinum(int x, int y ,int z)
{return (x > y?(x > z? x : z):(y>z?y:z));
}float maxinum(float x, float y ,float z)
{return (x > y?(x > z? x : z):(y>z?y:z));
}char maxinum(char x, char y ,char z)
{return (x > y?(x > z? x : z):(y>z?y:z));
}
//StudybarCommentBegin
int main()
{int b1, b2, b3;float c1, c2, c3;char a1, a2, a3;cin >> b1 >> b2 >> b3 >> c1 >> c2 >> c3>> a1 >> a2 >> a3;cout << maxinum(b1, b2, b3) << ' ' << maxinum(c1, c2, c3) << ' ' << maxinum(a1, a2, a3);return 0;
}
//StudybarCommentEnd

2.重载middle函数,读后缀代码,设计不同类型参数的重载函数

Description:
编写一个C++风格的程序,建立一个名为middle的函数,其功能是返回三个数当中中间那个数的值。重载middle函数3次,分别完成返回3个整数、3个双精度数和3个无符号整数的中间那个数的值。要求这9个数分别存放在3个相应类型的数组中。

注意:程序前缀代码及后缀代码均已给出。

Sample Input:

Sample Output:
The numbers are 45 3 89
the middle of them is 45
The numbers are 12.4 6 55.8
the middle of them is 12.4
The numbers are 345 776 565
the middle of them is 565

//Description:
// 编写一个C++风格的程序,建立一个名为middle的函数,其功能是返回三个数当中中间那个数的值。重载middle函数3次,分别完成返回3个整数、3个双精度数和3个无符号整数的中间那个数的值。
//要求这9个数分别存放在3个相应类型的数组中。
//
//注意:程序前缀代码及后缀代码均已给出。
//
//Sample Input:
//无
//
//Sample Output:
//The numbers are 45 3 89
//the middle of them is 45
//The numbers are 12.4 6 55.8
//the middle of them is 12.4
//The numbers are 345 776 565
//the middle of them is 565#include <iostream>
using namespace std;
#include <algorithm>
int middle(int arr[3])
{sort(arr, arr+3);return arr[1];}
double middle(double arr[3])
{sort(arr, arr+3);return arr[1];}unsigned int middle(unsigned int arr[3])
{sort(arr, arr+3);return arr[1];}
//StudybarCommentBegin
int main()
{int iNumber[3]={45,3,89};double dNumber[3]={12.4,6,55.8};unsigned uNumber[3]={345,776,565};cout<<"\nThe numbers are ";for( int i=0;i<3;i++)cout<<iNumber[i]<<"\t";cout<<endl<<"the middle of them is "<<middle(iNumber)<<endl;cout<<"\nThe numbers are ";for( int i=0;i<3;i++)cout<<dNumber[i]<<"\t";cout<<endl<<"the middle of them is "<<middle(dNumber)<<endl;cout<<"\nThe numbers are ";for( int i=0;i<3;i++)cout<<uNumber[i]<<"\t";cout<<endl<<"the middle of them is "<<middle(uNumber)<<endl;return 0;
}
//StudybarCommentEnd

3.函数重载参数个数不同的模仿

设计一个做多个数相加的函数,并完成函数重载

举例

int myadd(int a,int b)
{
return a+b;
}

int myadd(int a,int b,int c)
{
return a+b+c;
}

//函数重载参数个数不同的模仿
//设计一个做多个数相加的函数,并完成函数重载
//
// 举例 
//
//int myadd(int a,int b)
//{
// return a+b;
//}
//
//int myadd(int a,int b,int c)
//{
// return a+b+c;
//}#include <iostream>
using  namespace std;
int myadd(int a,int b)
{return a+b;
}int myadd(int a,int b,int c)
{return a+b+c;
}
//StudybarCommentBegin
main()
{cout<<myadd(2,3)<<"\n";
cout<<myadd(2,3,4);}//StudybarCommentEnd

4、函数重载,读后缀代码,这里有数组做参数的重载

设计一个做多个数相加的函数,并完成函数重载

举例

int myadd(int a,int b)
{
return a+b;
}

int myadd(int a,int b,int c)
{
return a+b+c;
}

测试输入

2

输出

8

测试输入

3

输出

17

//设计一个做多个数相加的函数,并完成函数重载
//
// 
//
//举例
//
// 
//
//int myadd(int a,int b)
//{
// return a+b;
//}
//
//int myadd(int a,int b,int c)
//{
// return a+b+c;
//}
//
// 
//
//测试输入
//
//2
//
//输出
//
//8
//
//测试输入
//
//3
//
//输出
//
//17#include <iostream>
using namespace std;
int myadd(int a, int b)
{return a + b;}int myadd(int a, int b,int c)
{return a + b + c;}	int myadd(int a[],int n)
{int sum = 0;int i = 0;for(i = 0 ; i < n ;i++){sum += a[i];}return sum;
}
//StudybarCommentBegin
main()
{
int a[20],n,i;cin>>n;
if(n==2)cout<<myadd(5,3);
else if (n==3)cout<<myadd(5,3,9);
else if(n>3)
{for(i=0;i<n;i++){cin>>a[i];}cout<<myadd(a,n);
}}
//StudybarCommentEnd

5、时间类-构造函数重载

设置Cmytime类。

具有三个成员函数

构造函数

Set(int h,int m,int s)

Show()

输入 23 25 38

输出:

3:2:1

23:25:38

0:0:0

5:0:0

//设置Cmytime类。
//
//具有三个成员函数
//
//构造函数
//
//Set(int h,int m,int s)
//
//Show()
//
//输入  23  25 38
//
//输出:  
//
//3:2:1
//
//23:25:38
//
//0:0:0
//
//5:0:0#include <iostream>
using namespace std;
class Cmytime
{
private:int hour;int minute;int second;
public:Cmytime():hour(0),minute(0),second(0){};Cmytime(int h,int m, int s):hour(h),minute(m),second(s){};Cmytime(int h):hour(h),minute(0),second(0){};void Set(int h ,int m ,int s){hour = h;minute = m;second = s;}void Show(){cout <<hour <<":" <<minute <<":"<<second;}
};//StudybarCommentBegin
int main(void) {int h,m,s;cin>>h>>m>>s;Cmytime t1(3,2,1),t2,t3(5);
t1.Show();
cout<<"\n";
t1.Set(h,m,s);
t1.Show();
cout<<"\n";
t2.Show();
cout<<"\n";
t3.Show();return 0;
}//StudybarCommentEnd

6、时间类-构造函数-默认参数值实现

设置Cmytime类。

具有三个成员函数

构造函数

Set(int h,int m,int s)

Show()

输入 23 25 38

输出:

3:2:1

23:25:38

0:0:0

5:0:0

//设置Cmytime类。
//
//具有三个成员函数
//
//构造函数
//
//Set(int h,int m,int s)
//
//Show()
//
//输入  23  25 38
//
//输出:  
//
//3:2:1
//
//23:25:38
//
//0:0:0
//
//5:0:0#include <iostream>
using namespace std;
class Cmytime
{private:int hour;int minute;int second;public:Cmytime(int h,int m,int s):hour(h),minute(m),second(s){}Cmytime():hour(0),minute(0),second(0){}Cmytime(int h):hour(h),minute(0), second(0){}void Show(){cout <<hour <<":" <<minute <<":"<<second;}void Set(int h,int m,int s){hour = h;minute = m;second = s;}};//StudybarCommentBegin
int main(void) {int h,m,s;cin>>h>>m>>s;Cmytime t1(3,2,1),t2,t3(5);
t1.Show();
cout<<"\n";
t1.Set(h,m,s);
t1.Show();
cout<<"\n";
t2.Show();
cout<<"\n";
t3.Show();return 0;
}//StudybarCommentEnd

7、引用作为函数参数

利用“引用形参”实现两个变量的值互换

例如输入 3 5

输出 5 3

//利用“引用形参”实现两个变量的值互换
//
//例如输入 3 5
//
//输出 5 3#include <iostream>
using namespace std;void swap(int &i,int &j)
{int temp = i;i = j;j = temp;
}
//StudybarCommentBegin
#include <iostream>
using namespace std;void swap(int &,int &);
int main( )
{ int i,j;cin >> i >>j ;swap(i,j);cout<<i<<" "<<j<<endl;return 0;
}
//StudybarCommentEnd

8、 复习——指针作为函数参数

利用“引用形参”实现两个变量的值互换

例如输入 3 5

输出 5 3

//利用“引用形参”实现两个变量的值互换
//
//例如输入 3 5
//
//输出 5 3#include <iostream>
using namespace std;void swap(int *i, int *j)
{int temp = *i;*i = *j;*j = temp;
}
//StudybarCommentBegin
#include <iostream>
using namespace std;void swap(int *,int *);
int main( )
{ int i,j;cin >> i >>j ;swap(&i,&j);cout<<i<<" "<<j<<endl;return 0;
}
//StudybarCommentEnd

文章转载自:

http://jndFPpvj.mLntx.cn
http://i2YSbJl8.mLntx.cn
http://SpYK0PtC.mLntx.cn
http://5NyNzmrC.mLntx.cn
http://K7h8qzuJ.mLntx.cn
http://ebk9YDuc.mLntx.cn
http://9E9gnDul.mLntx.cn
http://ZVp2IIF8.mLntx.cn
http://pmdKMddb.mLntx.cn
http://dufQtKS0.mLntx.cn
http://fcQOq4W6.mLntx.cn
http://phPv7Vge.mLntx.cn
http://2Mx2hXbj.mLntx.cn
http://Xkr0vUMK.mLntx.cn
http://JgQjAufR.mLntx.cn
http://i9yOaN3i.mLntx.cn
http://cnWc2eLn.mLntx.cn
http://PtetV2U5.mLntx.cn
http://zJ6ToESD.mLntx.cn
http://ZBgt2H2j.mLntx.cn
http://lCPx14QL.mLntx.cn
http://FW7vNDzs.mLntx.cn
http://UxYajzVf.mLntx.cn
http://8BEi1EIi.mLntx.cn
http://T6065COQ.mLntx.cn
http://h9PNCjHQ.mLntx.cn
http://X8IP12E5.mLntx.cn
http://A574xtQu.mLntx.cn
http://0SfwPQto.mLntx.cn
http://DWCY3q3n.mLntx.cn
http://www.dtcms.com/wzjs/644470.html

相关文章:

  • 一般网站建设的流程免费一百个空间访客领取网站
  • 做网站咋不用买虚拟机微商城有哪些平台
  • 搭网站可以用自己电脑做服务器吗如何配置php网站
  • 北京外贸网站建设中国建设银行的网站用户名是什么意思
  • 男女做那个是的视频网站wordpress 页脚居中
  • 移动终端的网站wordpress发布模块
  • 网站内容维护外包协议邢台专业网站建设公司推荐
  • 百度网站建设的一般要素常平做网站
  • 网站管理后台模板php网站开发实例教程源代码
  • 雏光 网络推广 网站建设建设类招标代理公司网站
  • 聊城招聘网站建设搜索优化
  • 做网站赚广告费好做吗wordpress怎么上传文本
  • 易企秀 旗下 网站建设ai国外教程网站
  • 网站开发技术实验教程网站站点是什么
  • 网站的动画广告横幅怎么做的西安市建网站
  • 做各国民宿租赁的网站wordpress 伪静态 页面
  • 宁夏网站制作哪家好网站推广与宣传怎么做
  • 怎么做照片网站ipv6网站建设东莞
  • 怎么做网站镜像微信小程序开发教程pdf
  • 网站建设 网页开发在线海报生成
  • 厦门网站开发公司深圳哪里网站建设好
  • 网站备案域名更改免费的会计做账系统
  • wordpress建教学网站深圳营销型网站建设设计公司
  • 如何重新做公司网站怎么制作公众号动图
  • 成功案例 品牌网站sae wordpress 插件
  • 大连建设工程信息网站seo如何推广网站
  • 网站域名到期怎么回事学校网站的建设需求
  • 漂亮的博客网站模板一个网站开发环境是什么
  • 织梦网站排版能调整吗少儿编程学什么
  • 2345中国最好的网址站桐城市建设局网站