明解c语言入门篇第六章
时间: 2023-10-26 10:26:29 浏览: 132
明解C语言入门篇
《明解C语言 第3版 入门篇》的第六章包括两个练习题,分别是练习6-3和练习6-6。练习6-3是一个计算输入数的立方的程序,代码如下:
#include<stdio.h>
int cube(int x) {
return x*x*x;
}
int main(void) {
int a ;
printf("请输入A的值:");
scanf("%d",&a);
printf("该值的立方为:%d",cube(a));
return 0;
}
练习6-6是一个根据输入的n值,按照次数发出响铃的程序,代码如下:
#include<stdio.h>
void alert(int ch, int n) {
putchar(ch);
}
int main(void) {
int a, i;
printf("请输入n值:");
scanf("%d",&a);
for(i=1;i<=a;i++) {
alert('\a',i);
}
return 0;
}<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [明解C语言(第3版)入门篇.[日]柴田望洋(带详细书签).pdf 【半高清】](https://download.csdn.net/download/kxjrzyk/11049496)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [明解C语言(入门篇)第六章](https://blog.csdn.net/a237664181a/article/details/89043758)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文