C语言的基础题目

[复制链接]
查看11 | 回复3 | 2012-3-10 16:19:49 | 显示全部楼层 |阅读模式
你的函数基本改好:#includevoid main(){
char ch;printf("please input your name's first letter:");putchar(ch=getchar()); //输出刚才你输入的字符 赋值给chputchar('\n');printf("Hello!\n");printf("This is a c program\n");printf("My name is %c",ch); //输出ch}...
回复

使用道具 举报

千问 | 2012-3-10 16:19:49 | 显示全部楼层
你用个scanf函数就好啦,这是修改过的。#includeint main(){
char ch;printf("please input your name's first letter:");scanf("%c",&ch);putchar('\n');printf("Hello!\n");printf(...
回复

使用道具 举报

千问 | 2012-3-10 16:19:49 | 显示全部楼层
比如你char ch;然后putchar到了ch,输出的时候printf("My name is %c",ch);就行了,输出的时候会把ch里的值填补到%c的位置...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行