资源描述
C+语言程序设计课后答案 - 第 二 章 C+简单程序设计 2-10 执行完以下语句后,a、b、c三个变量的值为多少? a = 30; b = a+; c = +a; 解: a:32 ; b:30 ; c:32; 2-13 写一条for语句,计数条件为n从100到200,步长为2;然后用while和dowhile语句完成同样的循环。 解: for循环: for (int n = 100; n void main int i int j; i = 10; /* 给i赋值 j = 20; /* 给j赋值 */ cout int main int i; int j; i = 10; / 给i赋值 j = 20; /* 给j赋值 */ cout int main int i; cout i; cout int main for (int i = 32; i?ABCDEFGHIJKLMNOP_QRSTUVWXYZabcdefghijklmnopqrstuvwxyzs 2-21 运行下面的程序,观察其输出,与你的设想是否一样? #include int main unsigned int x; unsigned int y = 100; unsigned int z = 50; x= y - z; cout int main int myAge = 39; / initialize two integers int yourAge = 39; cout #include void main char flag; while(1) cout flag; if ( toupper(flag) = Y) cout void main int i,score; cout score; if (score100 | score #include void main int i,j,k,flag; i = 2; while(i = 100) flag = 1; k = sqrt(i); j = 2; while (j = k) if(i%j = 0) flag = 0; break; j+; 第 3 页 共 3 页
展开阅读全文