C Primer Plus编程练习答案(Chapter7)
7.12.1
#include
int main() {
int score1 = 0, score2 = 0, score3 = 0;
char ch;
printf("Please enter strings(enter'#'to quit): ");
scanf_s("%c", &ch);
while (ch != '#') {
if (ch == ' ')
score1++;
else if (ch == '/n')
score2++;
else
score3++;
scanf_s("%c", &ch);
}
printf("/nDone./n");
printf("There %d blank %d enter and %d chars", score1, score2, score3);
return 0;
}
7.12.2
#include
int main() {
char ch;
int score = 0;
共有 0 条评论