最新回答 / 慕沐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 轉short b 是因為100在short的可轉換范圍內,如果你換成1000000試試,不管你是 short b = a,還是short b = (short)a; 都沒用,都會丟失
2023-03-19
#include <stdio.h>
int main()
{
printf("Hello 你好! \n");
return 0;
}
這樣好像也可以
int main()
{
printf("Hello 你好! \n");
return 0;
}
這樣好像也可以
2023-03-13