update in class
This commit is contained in:
parent
f550c63324
commit
75fd384742
97
class/class_test.cpp
Normal file
97
class/class_test.cpp
Normal file
@ -0,0 +1,97 @@
|
||||
#include<iostream>
|
||||
#include<windows.h>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
int main(){
|
||||
int a,b,c;
|
||||
|
||||
cin >>a>>b>>c;
|
||||
|
||||
/*if (a = 1)
|
||||
{
|
||||
cout <<"no";
|
||||
Sleep(1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if ((a+b) > c)
|
||||
{
|
||||
cout <<"yes";
|
||||
Sleep(1000);
|
||||
return 0;
|
||||
}else if ((a+c) > b)
|
||||
{
|
||||
cout <<"yes";
|
||||
Sleep(1000);
|
||||
return 0;
|
||||
}else if ((b+c) > a)
|
||||
{
|
||||
cout <<"yes";
|
||||
Sleep(1000);
|
||||
return 0;
|
||||
}else
|
||||
{
|
||||
cout <<"no";
|
||||
Sleep(1000);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
int main(){ //三角形判断
|
||||
int a,b,c;
|
||||
|
||||
cin >>a>>b>>c;
|
||||
|
||||
if ((a+b > c) && (a+c > b) && (b+c > a))
|
||||
{
|
||||
cout <<"yes";
|
||||
}else
|
||||
{
|
||||
cout <<"no";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main() {
|
||||
srand(static_cast<unsigned int>(time(nullptr))); // 初始化随机数种子
|
||||
int random_number = rand() % 5 + 1; // 生成 1 到 5 之间的随机数
|
||||
cout <<random_number<<endl;
|
||||
int player_cin;
|
||||
|
||||
cout <<"输入你猜的数字,1-5之间"<<endl;
|
||||
cin >> player_cin;
|
||||
|
||||
if (player_cin == random_number)
|
||||
{
|
||||
cout <<"恭喜您,中奖了!奖金10元!"<<endl;
|
||||
return 0;
|
||||
}else
|
||||
{
|
||||
cout <<"没中奖!请付费2元"<<endl;
|
||||
cout <<"中奖号码是:"<<random_number<<endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
int main(){
|
||||
int n = 6;
|
||||
|
||||
//cin >> n;
|
||||
|
||||
int sum = n * (n+1) /2;
|
||||
|
||||
cout <<sum;
|
||||
return 0;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#include<iostream>
|
||||
#include<iostream> //字母位移
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user