mirror of
http://106.12.3.193:3000/violeteverisland/learn_cpp.git
synced 2026-03-07 17:17:33 +08:00
1
This commit is contained in:
37
变量.cpp
Normal file
37
变量.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Created by viole on 2026/2/18.
|
||||
//
|
||||
#include "iostream"
|
||||
#include "windows.h"
|
||||
using namespace std;
|
||||
|
||||
void purchase();
|
||||
|
||||
int main() {
|
||||
// system("chcp:65001");
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
int age;
|
||||
float height ;
|
||||
char gender;
|
||||
gender = 'M';
|
||||
string name;
|
||||
name = "xiaoming";
|
||||
height = 180.5;
|
||||
age = 21;
|
||||
cout<<to_string(age+height+gender)+name<<endl;
|
||||
cout<<age<<endl;
|
||||
cout<<"开始计算花费"<<endl;
|
||||
purchase();
|
||||
return 0;
|
||||
}
|
||||
void purchase() {
|
||||
float fee = 50;
|
||||
int a = 1 ,b = 2 ,c = 3;
|
||||
cout<<a<<b<<c<<endl;
|
||||
|
||||
fee = fee-5;
|
||||
fee = fee +10;
|
||||
fee = fee -2 ;
|
||||
fee = fee*2;
|
||||
cout<<fee<<endl;
|
||||
}
|
||||
Reference in New Issue
Block a user