中易网

谁帮做个C++最简单的程序

答案:7  悬赏:70  
解决时间 2021-04-27 01:28
  • 提问者网友:江鱼
  • 2021-04-26 20:33
定两个值X和Y,X=1,Y=2,再把X、Y的赋给Z,就可以啦,本人刚学C++,也写了一个老是出错,谁帮我写一个对的我来比较一下,看错在什么地方。
最佳答案
  • 二级知识专家网友:风格单纯
  • 2021-04-26 21:26
#include<iostream.h>
void main()
{
 int x=1,y=2,z;
 z=x+y;
 cout<<z<<endl;
}
全部回答
  • 1楼网友:厭世為王
  • 2021-04-27 02:00

#include<stdio.h>

#include<stdlib.h>

main()

{

int x=1,y=2,z;

z=x+y;

printf("x为%d y为%d\n z为%d",x,y,z);

system("pause");

}

  • 2楼网友:而你却相形见绌
  • 2021-04-27 00:47

#include <iostream>
using namespace std;
int main()
{
 int x,y,z;

cin>>x>>y;
 z=x+y;
 cout<<z<<endl;

system("pause");
 return 0;
}

  • 3楼网友:都不是誰的誰
  • 2021-04-27 00:27

#include <iostream>
using namespace std;
int main()
{
 int x,y,z;

cin>>x>>y>>end;
 z=x+y;
 cout<<z<<endl;


 return;
}

  • 4楼网友:迷人小乖乖
  • 2021-04-26 23:30
#include <stdlib.h> #include <iostream> using namespace std; int main(int argc, char** argv) {     int x,y,z;     x = 1;     y = 2;     z = x + y;     cout << "z=x+y=" << z << endl;     return (EXIT_SUCCESS); }
  • 5楼网友:转身→时光静好
  • 2021-04-26 22:40

dim x,y

x=1

y=2

z(x,y)

  • 6楼网友:社会水太深
  • 2021-04-26 22:32
#include "stdafx.h" #include <iostream> using namespace std; int main() {  int x=1,y=2,z;  z=x+y;  cout<<z<<endl;  while(1); }
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息!
大家都在看
推荐信息