c作业题课案

:1:使用for循环,随机生成200个随机数(rand,stdlib.h) #include iostream #include stdlib.h using namespace std; int main() { int i; for(i=1;i=200;i++) coutrand(),; return 0; } 2:打印10*20个星号* #include iostream using namespace std; int main() { int i,n; for(i=1;i=10;i++) { for(n=1;n=20;n++) cout*; coutendl; } return 0; } 3:for循环显示26个小写字母和ASCII码 #includeiostream using namespace std; int main() { char ch=a; int i; for(i=0;i=25;i++) { ch=a+i; int y=ch; coutch yendl; } return 0; } 4:定义一个函数,判断一个数是否为素数,是返回1,否返回0 (1)#includeiostream using namespace std; int main() { int x; cinx; int i; int flag=1

文档评论(0)

1亿VIP精品文档

相关文档