C++写程序输出a+b+c的和

2025-01-18 17:52:46
推荐回答(4个)
回答1:

#include "stdafx.h"
#include

void Max2(double a,double b)
{
int max=a>b?a:b,
cout<<"Double a "<<"and"<<" double b's Max is:"< return ;
}

void Max2(int a int b)
{
int max=a>b?a:b;
cout<<"Int a "<<"and"<<" int b's Max is:"< return ;
}
void Max3(double a,double b,double c)
{
double temp=a>b?a:b;
double max1 = temp1>c?temp:c;
cout<<"Double a "<<", double b "<<"and"<<" double c's Max is:"< return;
}

void Max3(int a,int b,int c)
{
double temp=a>b?a:b
double max= temp>c?temp:c;
cout<<"Int a "<<", int b "<<"and"<<" int c's Max is:"<}

int main(int argc, char* argv[])
{
double a,b,c;
// int a,b,c;
cin>>a;
cin>>b;
cin>>c;
Max2(a,b);
Max3(a,b,c);
return 0;
}

回答2:

#include
using namespace std;

int main()
{
int a,b,c;
cout<<"依次输入a,b,c的值,用空格或者回车分开"<cin>>a>>b>>c;
cout<<"a+b+c="<return 0;
}

回答3:

#include
int main()
{
std::cout<<"Enter three nembers:"< int a,b,c;
std::cin >>a>>b>>c;
std::cout << "The sum of " << a<< " and " < << " is " < system("PAUSE");
return 0 ;
}

回答4:

用你的开发环境(VC6/VC2003/VC2005/VC2008/Vc2010/VC2012)创建个命令行程序工程

然后在那个工程提供的文件中编写你的代码
通过在main函数中调用你的函数完成你的需求.