您的位置:首页 > 其它

随机数生成---加法学习工具

2012-04-12 23:40 148 查看
#include <iostream>

#include <cstdlib>

#include <ctime>

using namespace std;

void main()

{

srand(time(0));

int a = rand() % 100;

int b = rand() % 100;

int c = rand() % 100;

cout<<a<<"+"<<b<<"+"<<c<<"="<<endl;

int answer;

cin>>answer;

cout<<((answer == a + b + c) ? "right" : "wrong")<<endl;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: