| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 625 人关注过本帖
标题:编程题,请求看看
只看楼主 加入收藏
chencangolds
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2012-2-21
结帖率:0
收藏
已结贴  问题点数:20 回复次数:5 
编程题,请求看看
1. 编程序,循环进行如下的处理过程:由计算机生成简单的四则运算题;用户给出答案;计算机判断对错。直到用户回答说不再继续做了时结束程序。
提示:可让用户选择指定出加、减、乘、除哪一种运算题,以及出一位数还是两位数的运算题;而后通过使用“rand()%10”或“rand()%100”来获得一个0到9的一位整数随机值或得到0到99的两位整数随机值来为用户出题。还可进一步对用户所做算术题的对错次数进行记录,结束程序时给出一个某种形式的成绩。


Include<iostream>
Using nsmespace
Int main()
{Int m,n,t,I;
cout<<”请选择类型+-*/”
cin>>t;
*=t;-=t;+=t;/=t;
Switch(i!=0){
Case( “*”):
Int t,I,n,m;
Cout<<”请选择位数:1或2或随机t”
Cin>>m;
M=1; m=2;  m=t;
Switch(m!=0)
Case(1):  If (i>=0&&i<=9 )  For(i=0; i<=9;i++)
Case(2):  If(i>=10) For(i=10; i>=10;i++)
Case(t):  i=rand(t)%10
I*i++=t;
Cin>>n>>endle;
If n==t cout<<”right”
Else cout<<”wrong”  m++

Case(”+”):
Int t,I,n,m;
Cout<<”请选择位数:1或2或随机t”
Cin>>m;
M=1; m=2;  m=t;
Switch(m!=0)
Case(1):  If (i>=0&&i<=9 )  For(i=0; i<=9;i++)
Case(2):  If(i>=10) For(i=10; i>=10;i++)
Case(t):  i=rand(t)%10
I+i++=t;
Cin>>n>>endle;
If n==t cout<<”right”
Else cout<<”wrong”  m++

Case(”_”):
Int t,I,n,m;
Cout<<”请选择位数:1或2或随机t”
Cin>>m;
M=1; m=2;  m=t;
Switch(m!=0)
Case(1):  If (i>=0&&i<=9 )  For(i=0; i<=9;i++)
Case(2):  If(i>=10) For(i=10; i>=10;i++)
Case(t):  i=rand(t)%10
i++_i=t;
Cin>>n>>endle;
If n==t cout<<”right”
Else cout<<”wrong”  m++

Case(”/”):
Int t,I,n,m;
Cout<<”请选择位数:1或2或随机t”
Cin>>m;
M=1; m=2;  m=t;
Switch(m!=0)
Case(1):  If (i>=0&&i<=9 )  For(i=0; i<=9;i++)
Case(2):  If(i>=10) For(i=10; i>=10;i++)
Case(t):  i=rand(t)%10
i++/i=t;
Cin>>n>>endle;
If n==t cout<<”right”
Else cout<<”wrong”  m++

Cout<<n++<<’/t’<<m++<<endl;
Return 0
}
我是新手,这是我写的,请求帮助
搜索更多相关主题的帖子: 计算机 编程 算术题 用户 
2012-02-21 16:43
pangding
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:北京
等 级:贵宾
威 望:94
帖 子:6784
专家分:16751
注 册:2008-12-20
收藏
得分:7 
你起码得把该小写的字母小写一下才行。
2012-02-21 21:50
泡泡Kies
Rank: 1
等 级:新手上路
帖 子:1
专家分:7
注 册:2012-2-21
收藏
得分:7 
编程时最后双斜杠注释下嘛
2012-02-21 21:55
chencangolds
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2012-2-21
收藏
得分:0 
1. 编程序,循环进行如下的处理过程:由计算机生成简单的四则运算题;用户给出答案;计算机判断对错。直到用户回答说不再继续做了时结束程序。
提示:可让用户选择指定出加、减、乘、除哪一种运算题,以及出一位数还是两位数的运算题;而后通过使用“rand()%10”或“rand()%100”来获得一个0到9的一位整数随机值或得到0到99的两位整数随机值来为用户出题。还可进一步对用户所做算术题的对错次数进行记录,结束程序时给出一个某种形式的成绩。


include<iostream>
using namespace std;
int main()
{int m,n,t,i;
cout<<”请选择类型+-*/”
cin>>t;
*=t;-=t;+=t;/=t;
switch(i!=0){              /*用switch来让用户选择加,减,乘,除*/
case( “*”):
int t,I,n,m;
cout<<”请选择位数:1或2或随机t”
cin>>m;
m=1; m=2;  m=t;
switch(m!=0)
case(1):  if (i>=0&&i<=9 )  for(i=0; i<=9;i++)     //选择一位数或多位数//
case(2):  if(i>=10) for(i=10; i>=10;i++)
case(t):  i=rand(t)%10
i*i++=t;
cin>>n>>endle;
if n==t cout<<”right”
else cout<<”wrong”  m++

Case(”+”):
int t,i,n,m;
cout<<”请选择位数:1或2或随机t”
cin>>m;
m=1; m=2;  m=t;
switch(m!=0)
case(1):  if (i>=0&&i<=9 )  for(i=0; i<=9;i++)
case(2):  if(i>=10) for(i=10; i>=10;i++)
case(t):  i=rand(t)%10
i+i++=t;
cin>>n>>endle;
if n==t cout<<”right”
else cout<<”wrong”  m++

case(”_”):
int t,i,n,m;
cout<<”请选择位数:1或2或随机t”
cin>>m;
m=1; m=2;  m=t;
switch(m!=0)
case(1):  if (i>=0&&i<=9 )  for(i=0; i<=9;i++)
case(2):  if(i>=10) for(i=10; i>=10;i++)
case(t):  i=rand(t)%10
i++_i=t;
cin>>n>>endle;
if n==t cout<<”right”
else cout<<”wrong”  m++

case(”/”):
int t,I,n,m;
cout<<”请选择位数:1或2或随机t”
cin>>m;
m=1; m=2;  m=t;
switch(m!=0)
case(1):  if (i>=0&&i<=9 )  for(i=0; i<=9;i++)
case(2):  if(i>=10) for(i=10; i>=10;i++)
case(t):  i=rand(t)%10
i++/i=t;
cin>>n>>endle;
if n==t cout<<”right”
else cout<<”wrong”  m++

cout<<n++<<’/t’<<m++<<endl;
return 0
}

再请大家帮忙修改修改。万分感谢,急用
2012-02-22 19:34
BianChengNan
Rank: 8Rank: 8
等 级:贵宾
威 望:13
帖 子:302
专家分:972
注 册:2011-11-30
收藏
得分:7 
这个。。。。。。各种语法错误的啊

我的群:149544757 C/C++/Assembly 喜欢交流的朋友进,进群请写消息
2012-02-23 10:58
xihuadaxue
Rank: 1
来 自:四川宜宾
等 级:新手上路
帖 子:3
专家分:0
注 册:2011-11-20
收藏
得分:0 
语法啊~~~
给你一个加法的代码,至于* - /可以用类,运用函数重载~~  再定义int score几分,
#include<iostream.h>
#include<stdlib.h>                      //随机函数的库函数
#include<time.h>                        //时间函数 用于调用种子time
int main(){
    int sum,num1,num2,rtn;
    srand((unsigned)time(NULL));
    do{
    num1=rand()%100;
    num2=rand()%100;
    cout<<"";
    cout<<num1<<"+"<<num2<<"=";
    cin>>sum;
    if(sum!=num1+num2)
        cout<<""<<endl;
    else
        cout<<""<<endl;
    cout<<"";
    cin>>rtn;     //用于退出
    }
    while(rtn!=0);
    return 0;
}
2012-03-04 20:47
快速回复:编程题,请求看看
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018698 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved