复兴无基础第一课 初始C++
2025-08-02 20:43:06
发布于:上海
T1输出文字
#include <iostream>
using namespace std;
int main() {
cout << "hello world";
return 0;
}
T2hello c++
#include <iostream>
using namespace std;
int main() {
cout << "hello world" << endl;
cout << "hello c++";
return 0;
}
T3输出三角形
#include <iostream>
using namespace std;
int main() {
cout << " *" << endl;
cout << " ***" << endl;
cout << "*****" << endl;
return 0;
}
T4计算
#include <iostream>
using namespace std;
int main() {
cout << 123 + 123;
return 0;
}
T5两整数求和
#include<iostream>
using namespace std;
int main(){
int a , b;
cin >> a >> b;
cout << a + b ;
return 0;
}
T6两个变量1
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << a << " " << b;
return 0;
}
T7第二个整数
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << b;
return 0;
}
T8输出文字1
#include <iostream>
using namespace std;
int main() {
cout << "Hello world";
return 0;
}
T9输出图形
#include <iostream>
using namespace std;
int main() {
cout << " *" << endl;
cout << " * *" << endl;
cout << " * *" << endl;
cout << "*******" << endl;
return 0;
}
T10分苹果
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << 120 - a - b;
return 0;
}
T11输出 a + b 的和
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << a << "+" << b << "=" << a + b;
return 0;
}
这里空空如也
有帮助,赞一个