上海怎么去舟山群岛:C++ 谢谢 帮帮忙

来源:百度文库 编辑:高考问答 时间:2024/05/06 02:21:53
______________________________________________。
8、if….else语句的语法格式为__________________________________________。

三、 将下列数学表达式写成C语言表达式:
s=a×b k=m+n v= y=x3+5x2+8
f= p= s= y=6x3-3x2+9
x>8m y<2x i≤m x≥n

i≠j Y=X1+X22+X33

四、 写出下列代码段中表达式的值
1. double a=2,b=4,s;
s=a+b; //表达式的值为______________

2. double a=2,b=4,s;
s=a*b; //表达式的值为______________

3. double a=2,b=4,s;
s=a/b; //表达式的值为______________

4. double a=4,b=3,s;
s=a%b; //表达式的值为______________

5. double a=2;
a++ ; //表达式的值为______________
a-- ; //表达式的值为______________

6. double a=2;
a+=8; //表达式的值为______________

7. double a=2,b=4;
8= =a+b; //表达式的值为______________

8.double a=2,b=4;
b= =a+2; //表达式的值为______________

9. double a=2,b=4;
a&&b-4; //表达式的值为______________

10. double a=2,b=4;
a||b&&(a-b); //表达式的值为______________

11. double a=2,b=4;
!a&&b||0; //表达式的值为______________

12. double a=2,b=4,s;
a>=5&&b<=5; //表达式的值为______________

五、 写出下列程序的输出结果()
1、#include <iostream>
using namespace std;
int main()
{
int a=2,b=-1,c=2;
if (a<b)
c-=1;
else
c+=1;
cout<<c<<endl;
}
输出结果:
2、#include <iostream>
using namespace std;
int x;
int main()
{
int y;
y=x+2;
cout<<”y=”<<y<<endl;
} 输出结果是:
3、#include <iostream>
using namespace std;
int main()
{
cout<<”这是第一个C++程序”;
return 0;
}
输出结果是:
4、#include <iostream>
using namespace std;
int main()
{
int x=6 , y=18, s;
s=y%x;
cout<<”s=”<<s<<endl;
} 输出结果是:

5、#include <iostream>
using namespace std;
int main()
{
int s;
for(int k=2;k<6;k+=2)
{s=1;
for(int j=k;j<6;j++)
s+=j;
} 输出结果是:
cout<<s<<endl;
}

题目太多了 而且都是挺简单的基础题 一般只要稍微学认真点就能知道
其实上机运行一下 马上就能知道了

你不觉得简单呀!!!
自己多动脑筋哟!!