97 lines
1.5 KiB
C++
97 lines
1.5 KiB
C++
|
#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;
|
||
|
}
|