c语言代码问题

[复制链接]
查看11 | 回复5 | 2012-3-12 15:38:38 | 显示全部楼层 |阅读模式
#include#includevoid main(){char str[100],str1[]={“happy”};scanf("%s",&str);
str=strcat(str,str1);//strcat是字符串连接函数printf("%s \n", str);} 这个程序应该符合你要求了,下次提问最好说清楚一点方便解答...
回复

使用道具 举报

千问 | 2012-3-12 15:38:38 | 显示全部楼层
#includevoid main(){char a[20], *b=a[20];scanf("%s",b);//输入how are you
if(b=="how are you")printf("happy");}这是对的。...
回复

使用道具 举报

千问 | 2012-3-12 15:38:38 | 显示全部楼层
#includevoid main(){char b[100]="how are you";//定义字符数组,才存下字符串gets(b);puts(b);//输出bprintf("happy");}...
回复

使用道具 举报

千问 | 2012-3-12 15:38:38 | 显示全部楼层
#includevoid main(){char *b;//定义指针变量。gets(b);puts(b);//输出bprintf("happy");
getchar();}...
回复

使用道具 举报

千问 | 2012-3-12 15:38:38 | 显示全部楼层
#includevoid main(){char str[100] = {0};
printf("how are you\n");scanf("%s",&str);printf("%s happy\n", str);}...
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行