[問題] 想請問有關字串的問題
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
c++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
他的題目是這樣
串寫一個程式,由使用者先輸入姓氏,再輸入名字,輸出時則先印出名字,再印出姓氏。
餵入的資料(Input):
/*prog3_2 試題*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char name[1];
printf("你的姓?\n");
scanf("%s",name);
char name1[2];
printf("你的名?\n");
scanf("%s",name1);
printf("名子:%s, 姓:%c\n",name1,name);
system("pause");
return 0;
}
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
補充說明(Supplement):
我不知道要怎樣才能讓姓輸出正確
麻煩各位大大了~
--
小本經營賣場 http://tw.user.bid.yahoo.com/tw/user/Y2286184456
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.39.113.166
→
08/18 20:04, , 1F
08/18 20:04, 1F
→
08/18 20:06, , 2F
08/18 20:06, 2F
→
08/18 20:07, , 3F
08/18 20:07, 3F
→
08/18 20:54, , 4F
08/18 20:54, 4F
→
08/18 22:46, , 5F
08/18 22:46, 5F
推
08/19 17:17, , 6F
08/19 17:17, 6F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章