1.编译软件的安装与使用
直接下载安装版,然后点击程序进入,建议选择白色主题(不伤眼),下面图示说明,当然也可以直接在在线平台上学习操作(如ACWING:https://www.acwing.com/)
https://royqh1979.gitee.io/redpandacpp/
2.作业的评测与提交
推荐北大闫学灿学长的ACWING网站(你也可以报他的课程,性价比极高)
在线练习地址:www.acwing.com
作业提交地址:https://www.acwing.com/activity/content/21/
#include
using namespace std;
int main()
{
cout << "Hello World" << endl;
return 0;
}
F10,保存并运行,查看结果。恭喜你!全世界所有程序员的第一个程序编译测试完成!
变量必须先定义,才可以使用。不能重名。
变量定义的方式:
#include
using namespace std;
int main()
{
int a = 5;
int b, c = a,d = 10 / 2;
return 0;
}
#include
using namespace std;
int main()
{
int a, b;
cin >> a >> b ;
cout << a + b << endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
string str;
cin >> str;
cout << str << endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
int a, b;
string str;
cin >> a;
cin >> b >> str;
cout << str <<"!!!" << a + b << endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
int a = 6 + 8 * 4 / 2 - 2;
cout << a << endl;
int b = a * 4 + 10 / 2;
cout << b << endl;
cout << 25 * 56 - 88 / 4 << endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
float x = 1.3, y = 3.4;
cout << x * y << ' ' << x + y <<endl;
cout << x - y << ' ' << x / y <<endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
int a = 1;
int b = a ++;
cout << a << ' ' << b <<endl;
int c = ++ a;
cout << a << ' ' << c <<endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
float x = 133.56;
int y = (int)x;
cout << x << ' ' << y <<endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
cout << b << endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
cout << (a + b) * c << endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
int c = a / b, d = a % b;
cout << c << ' ' << d << endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
int n;
cin >> n;
int a = n % 10;
n = n / 10;
int b = n % 10;
n = n / 10;
int c = n ;
cout << a << b << c << endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
int a=20;
int b=30;
int c = b;
b = a;
a = c;
cout << a <<' '<< b << endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
char a;
cin >> a;
cout << " " << a << endl;
cout << " " << a << a << a << endl;
cout << a << a << a << a << a << endl;
cout << " " << a << a << a << endl;
cout << " " << a << endl;
return 0;
}