Compare commits
5 Commits
c03026824f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 65c091224d | |||
| 71f12730cc | |||
| 111dee6c4c | |||
| c69029e578 | |||
| 2ed493d32f |
22
cin数据输入.cpp
22
cin数据输入.cpp
@@ -2,25 +2,9 @@
|
|||||||
// Created by viole on 2026/2/25.
|
// Created by viole on 2026/2/25.
|
||||||
//
|
//
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "windows.h"
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
int main() {
|
int main() {
|
||||||
SetConsoleOutputCP(CP_UTF8);
|
int num ;
|
||||||
string name;
|
cin >> num;
|
||||||
double height;
|
cout << num << endl;
|
||||||
int age;
|
|
||||||
cout << "请输入你的姓名:" <<endl;
|
|
||||||
cin >> name;
|
|
||||||
|
|
||||||
cout << "请输入你的身高(cm):" <<endl;
|
|
||||||
cin >> height;
|
|
||||||
|
|
||||||
cout << "请输入你的年龄:" <<endl;
|
|
||||||
cin >> age;
|
|
||||||
cout << "--------"<<endl;
|
|
||||||
cout << "信息输入完成,您的信息如下:"<<endl;
|
|
||||||
cout<<"姓名:"<<name<<endl;
|
|
||||||
cout<<"身高:"<<height<<endl;
|
|
||||||
cout<<"年龄:"<<age<<endl;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
13
比较运算符.cpp
13
比较运算符.cpp
@@ -1,13 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by violet on 2026/2/28.
|
|
||||||
//
|
|
||||||
#include "iostream"
|
|
||||||
using namespace std;
|
|
||||||
int main() {
|
|
||||||
//==相等 !=不等 >大于 <小于 <=小于等于>=大于等于
|
|
||||||
int num1 =3;
|
|
||||||
int num2 =4;
|
|
||||||
bool r1 = (num1!=num2);
|
|
||||||
cout<<r1<<endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
19
算数运算符.cpp
19
算数运算符.cpp
@@ -1,19 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by violet on 2026/2/28.
|
|
||||||
//
|
|
||||||
#include "iostream"
|
|
||||||
using namespace std;
|
|
||||||
int main() {
|
|
||||||
//单目(一个操作数)运算符
|
|
||||||
int num1 = +10;
|
|
||||||
int num2 = -10;
|
|
||||||
cout <<num1<<","<<num2<<endl;
|
|
||||||
//双目(有两个操作数)操作符
|
|
||||||
int num3 = 5+5;
|
|
||||||
int num4 = 5-3;
|
|
||||||
int num5 = 5*5;
|
|
||||||
int num6 = 10/3;
|
|
||||||
int num7 = 10%3;
|
|
||||||
cout<<num3<<","<<num4<<","<<num5<<","<<num6<<","<<num7<<endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
23
赋值运算符.cpp
23
赋值运算符.cpp
@@ -1,23 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by violet on 2026/2/28.
|
|
||||||
//
|
|
||||||
#include "iostream"
|
|
||||||
using namespace std;
|
|
||||||
int main() {
|
|
||||||
int num =2,num1,num2,num3,num4,num5;
|
|
||||||
num +=3;cout<<num<<endl;
|
|
||||||
bool a = true;
|
|
||||||
cout<<a<<endl;
|
|
||||||
|
|
||||||
|
|
||||||
num -=2,cout<<num<<endl,
|
|
||||||
num *=2,cout<<num<<endl,
|
|
||||||
num /=3,cout<<num<<endl,num %=2,cout<<num<<endl;
|
|
||||||
int money = 50;
|
|
||||||
money-=5;
|
|
||||||
money+=10;
|
|
||||||
money-=2;
|
|
||||||
money*=2;
|
|
||||||
cout<<money<<endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user