最新回答 / 慕沐8157732
#include?<stdio.h>?這是C語言的頭文件 #include?<iostream>?這是C++語言的頭文件兩者可以理解作用相同
std::cin?>>?a?>>?b;這里是屬于#include?<iostream>因此,
必須要包含#include?<iostream>
2023-03-23
#include <iostream>
using namespace std;
#include <string>
int main()
{
int a=1;
int b=2;
cout << "a+b=" << a+b<<endl;
cout << "a-b=" << a-b<<endl;
cout << "a*b=" << a*b<<endl;
cout << "a/b=" << a/b<<endl;
int c=5;
float d=3.25;
cout << "c+d=" << c+d<<endl;
}
using namespace std;
#include <string>
int main()
{
int a=1;
int b=2;
cout << "a+b=" << a+b<<endl;
cout << "a-b=" << a-b<<endl;
cout << "a*b=" << a*b<<endl;
cout << "a/b=" << a/b<<endl;
int c=5;
float d=3.25;
cout << "c+d=" << c+d<<endl;
}
這里是不是講的不對,a=100 轉(zhuǎn)short b 是因為100在short的可轉(zhuǎn)換范圍內(nèi),如果你換成1000000試試,不管你是 short b = a,還是short b = (short)a; 都沒用,都會丟失
2023-03-19
int main()
{float a;int b;cin >> a ;
if(a>=90){b=1;}
else if(90>a&a>=75)
{b=2;}
else if(75>a&a>=60){b=3;}
else {b=4;}
switch(b)
{case 1:cout << "優(yōu)" << endl;break;case 2:cout << "良" << endl;break;case 3:cout << "中" << endl;break;case 4:cout << "差" << endl;break; }return 0;}
{float a;int b;cin >> a ;
if(a>=90){b=1;}
else if(90>a&a>=75)
{b=2;}
else if(75>a&a>=60){b=3;}
else {b=4;}
switch(b)
{case 1:cout << "優(yōu)" << endl;break;case 2:cout << "良" << endl;break;case 3:cout << "中" << endl;break;case 4:cout << "差" << endl;break; }return 0;}
#include <stdio.h>
int main()
{
printf("Hello 你好! \n");
return 0;
}
這樣好像也可以
int main()
{
printf("Hello 你好! \n");
return 0;
}
這樣好像也可以
2023-03-13