#include<iostream.h>#include<iostream.h> classlt26 notee{ private: char name[30]; char countr

您的举报已经提交成功,我们将尽快处理,谢谢!
#include&iostream.h&classA{ (inti){x=i;}voidfun1(intj){x+=j;cout&&"fun1:"&&x&&en...
大家还关注
(window.slotbydup=window.slotbydup || []).push({
id: '2081942',
container: s,
size: '1000,60',
display: 'inlay-fix'关于C++的 帮忙写个代码 要求如下_百度知道
关于C++的 帮忙写个代码 要求如下
Mu代表乘法,M代表减法。如此循环。 2 要求使用switch语句:A(dd)
Q(uit),程序结束。A代表加法、continue控制程序流程, select one”提示用户输入。 1 要求使用if……,并实现相应的算术运算,用 break,D代表除法.else语句进行判断,当用户输入其中之一时,直到输入Q,产生两个随机数,运行时显示“Menu一个简单的菜单程序
提问者采纳
& & Q(uit);& &flag1; &cout&int n=rand()%1000; &nbsp://d;m-n& cout&#include& }cin&ctime&& srand(time(NULL));&string& {&& &nbsp.&#include&int m=rand()%1000; &/zhidao/wh%3D450%2C600/sign=755eeb0d0dcf/1f178a82bf3e0abee2c; &nbsp, select one"&lt:&& && case 'D'; cin&&cmath&&switch(choice)&&&m& }&&& & &&#include&&cstdlib& &nbsp:cout&#include& &&"M& while(&& &nbsp.baidu.jpg" />#include&n&M(inus) & &&nbsp:cout& {&&&&"& & & case 'M';iostream& &cstring&cout&"BYE"&&&m+n& case 'Q';#include&&m*n& &using namespace std!='Q')& &&endl: "&lt:cout&lt<img class="ikqb_img" src="http://d; goto flag1; case 'A':cout&lt.& default.Mu(ltify) &&nbsp://d; return 0;& &nbsp:A(dd) &nbsp
还是有错误诶,这样吧 你加我QQ
我问你OK? 你备注一下啊
你把错误贴出来。还有要自己学会debug。
好吧·····为什么乘法会出现两组数 ,而且一个运算的是减法,一个运算的才是乘法,怎么改?是按照你写的代码编的
#include&iostream&#include&string&#include&cstring&#include&ctime&#include&cstdlib&#include&cstdio&#include&cmath&int main(){
srand(time(NULL));
cout&&&Menu:A(dd)
Q(uit), select one&&&
while(choice !=&Q&)
int m=rand()%1000;
int n=rand()%1000;
cout&&&first number: &&&m&&
cout&&&second number: &&&n&&
if(choice==&Mu&)
cout&&m*n&&
char choice1=choice[0];
switch(choice1)
case &#39;A&#39;:cout&&m+n&&
case &#39;M&#39;:cout&&m-n&&
case &#39;D&#39;:cout&&m&#47;n&&
case &#39;Q&#39;:
goto flag1;
} flag1:cout&&&BYE&&&
return 0;}
#include&iostream&#include&string&#include&cstring&#include&ctime&#include&cstdlib&#include&cstdio&#include&cmath&int main(){
srand(time(NULL));
cout&&&Menu:A(dd)
Q(uit), select one&&&
while(choice !=&Q&)
int m=rand()%1000;
int n=rand()%1000;
cout&&&first number: &&&m&&
cout&&&second number: &&&n&&
if(choice==&Mu&)
cout&&m*n&&
char choice1=choice[0];
switch(choice1)
case &#39;A&#39;:cout&&m+n&&
case &#39;M&#39;:cout&&m-n&&
case &#39;D&#39;:cout&&m&#47;n&&
case &#39;Q&#39;:
goto flag1;
} flag1:cout&&&BYE&&&
return 0;}
提问者评价
非常感谢!现在是对的了
其他类似问题
为您推荐:
其他1条回答
废话不多说 我把用switch的情况 写了下
if...else的情况你自己模仿修改下
// Note:Your choice is C++ IDE
#include &iostream&
#include &string&
int add(int a,int b)
return a+b;
int Minus(int a,int b)
return a-b;
int Multify(int a,int b)
return a*b;
float Divid(int a,int b)
return a*b;
return -1;
void main(){
cout&&&..............算术运算系统..................&
A-加法运算&
M-减法运算&
Mu-乘法运算&
D-除法运算&
&&&\n请选择:
int a = rand()%10;
你这不是产生随机数啊
我晕 哪里不是随机数啊 是随机数啊
可是运算结果一个运算符号一种答案&&&&&&&&&你自己看类
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁在c++中为何要该为#include &iostream.h&_百度知道
在c++中为何要该为#include &iostream.h&
void display();} Complex C c3=c1+i;
&#47; c3=i+c1;&quot:
double real:; Complex Complex.imag);iostream&&quot,-10);用VC++时改为∶ #include & cout& int i=5.display(); cout& c3,&iostream:operator+(Complex &c){return Complex(real+c;}
Complex operator+(Complex &c2);&quot:operator+(int &i){return Complex(real+i.real:; },imag+c;&lt:display(){cout& return 0.h&}
Complex((&quot,double i){real=r;imag&; c3;}Complex operator+(int &i:
Complex(){real=0:,4);
&#47;用VC++时为取消此行class Complex {}int main(){Complex c1(3;&#47;c1+i=&c1+c2=&quot.i+c1=&imag=0;&lt,imag);&imag=i;real&lt.imag),Complex &c){return Complex(i+c;&lt,c2(5;
Complex operator+(int &i); c3=c1+c2; cout&
friend Complex operator+(int&;&lt,Complex &);&lt.display();&&}void C;&&;i)&&&&&lt,c;&lt,c3; c3.display();#include &&#47
iostream.0中无法使用#include &可以但#include &
using namespace std.h&iostream&gt在vc6
提问者采纳
h&gt,为了解决在编程中遇到的命名冲突问题:。例如我们通常所用的cout其实全名是std,第一个功能更强大,加了using namespace std,里面的变量限定在std中;和#include&lt,而#include&lt,因为在大型软件开发时会遇到大量变量命名,是为了与c兼容;后:,就可直接用cout了:命名空间是引入c++中的一种技术,加上using namespace std时。h中定义了这两句是告诉编译器包含文件iostream&gt,包含了这个头文件.h头文件,而#include&using namespace std.h&iostream,就可直接用cout了,那么遇到cout时;iostream&gt:cout,就告诉编译器使用std中的名字:cout了而在iostream。#include&中用的是是包含iostream,与c语言一样,就是iostream&gt。 #include&是两种完全不同的表示方法.h&gt。 #include&lt:cout
其他类似问题
为您推荐:
其他3条回答
iostream&gt。但建议用标准的;因为C++延续了并包含C语言的风格和内容所以#include&lt.h&gt,也可以用;(C风格)的和上边两句等效C++如果你用的是vc的话标准的是#include&lt
因为你用的VC版本低。。。。不够规范。是标准的!低版本VC中提供的编译器支持不好而已,新的VS2005以上版本没有这个问题
加上.h可以直接调用库函数如果不加,就需要名空间的支持 但是名空间是规范的写法
iostream的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁#include &windows.h& #include &ctime& #include &iostream& #include &vector& #include &queue&_百度知道
#include &windows.h& #include &ctime& #include &iostream& #include &vector& #include &queue&
这些头文件是什么意思
代码中要使用的各种函数,并检查你使用是不是正确、类,这样,用#include保护这些函数。否则,你的代码文件在编译时、类的声明的文件,编译器不知到这些函数是不是有,就知道是不是有这些函数、类存在,这些类是不是存在,在程序开始的地方
其他类似问题
为您推荐:
ctime的相关知识
其他1条回答
queue&gt#include &lt,cin(输入函数)都包含在这个库里 #include &定义活动文本模式窗口
#include &iostream&gt,cout(输出函数);windows,文件中包含了库才能调用其中的子函数#include & 向量相关操作函数所在的库;标准输入输出函数;vector&把日期和时间转换为字符串
#include &ctime&gt.h&gt
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁编译出错,出现很长一段很长的东西,求救啊_百度知道
编译出错,出现很长一段很长的东西,求救啊
5;&lt:9, _Traits&的最终成绩为&&lt:basic_ostream&lt:,c.7&#47:014;c++&#47,socre2;&char:
template argument deduction&#47, _Traits&gt:class _CharT;}’ is not derived from ‘std.7&#47;&lt: template&include&#47;;int main(){
int id:basic_istream&lt:;&&lt:9;
cout&lt:istream {&&c++&#47;
cin&lt:491;&lt:607.7&#47;&lt,a, unsigned char)&#47;&&include&#47;&lt:
template argument deduction&#47;_CharT;usr&#47:,求大神帮助;id&&&quot:0;&usr&#47:a&lt:char&4.7&#47:01cehngji.&lt.&lt:basic_ostream&&lt,socre,
from 01}’ is not derived from ‘ std.7&#47:&#47;endl:
template argument deduction&#47;请输入学生的期中成绩:0;&;请输入学生期末成绩所占的比例:basic_istream&
cin&lt, _Traits&&
double socre1;c++&#47.7&#47:basic_ostream&ostream: note:basic_istream&
cin&lt:58;4;socre1&lt:;&:491;endl::;&
cin&;;’In file included from &#47::&
cout&usr&#47;usr&#47;&lt.c++&#47;endl:, _Traits&gt:511;usr&#47;include&#47;4;4.cpp:basic_ostream&lt:40;
socre=socre1*a+socre2*b+socre3*c
cout&’In file included from &#47:operator&char&gt:&&(&c++&#47: note:basic_ostream&&
cout&请输入学生的学号:&:486.usr&#47;&lt:&usr&#47:5:;include&#47;&lt,我是菜鸟:5:basic_ostream&&char:
cout&,socre3;class _Traits&;c++&#47;&
cin&学号为&usr&#47:511;:
‘std::, _Traits&gt:
cin&lt: note:58, class _Traits&_CharT;&;&include&#47:substitution failed, _Traits&include&#47;&lt:;&lt:;&请输入学生期中成绩所占的比例;endl,b::40:5;_CharT.7&#47, const _CharT*)&#47;id&lt:486;请输入学生的平时成绩;include&#47;c++&#47, _Traits&4:operator&lt:basic_ostream&&quot:58:;usr&#47:1;c++&#47;
cout&lt:istream {socre2&lt:istream {ostream:&&b&lt:0;4:&#47:basic_ostream&请输入学生的期末成绩.7&#47;c&&include&#47;(std:;socre3&&
cout&lt:operator&(std:basic_ostream&lt, _Traits&gt:&quot:1;&lt:5: template&&substitution failed:&quot.7&#47程序;socre&class _Traits&gt:&#47:!;
cin&&char:9;include&#47;char&gt:01’In file included from &#47;c++&#47;}’ is not derived from ‘std:5: template&lt, _Traits&char: note,
from 01cehngji:#include&4;4;&lt:, signed char)&#47;&请输入平时成绩占的比例;&iostream&gt
提问者采纳
”;&gt,应该是“cin&gt输入运算符搞错了,方向搞错了
提问者评价
其他类似问题
为您推荐:
其他1条回答
h&iostream:#include &lt包含头文件应该这样写
我早就试过了我试过了,fatal error: iostream.h: 没有那个文件或目录compilation terminated.程序和书上的一样的,是是不是编译器的问题,我用的是opensuse系统
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 lt26 note 的文章

 

随机推荐