請教C++與結構

看板Programming作者時間18年前 (2007/04/22 15:32), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/4 (看更多)
請教一下,為何 person1.name2="Mary"; 會有問題呢? 謝謝 附上原始程式碼: #include <iostream> using namespace std; main( ) { struct company //結構 { char name2[20]; int salary; int prize; int total; }; struct company person1; person1.name2="Mary"; person1.salary=20000; person1.prize=1500; person1.total=person1.salary + person1.prize; cout << "姓名:" << person1.name2 <<endl; cout << "薪資:" << person1.salary<<endl; cout << "獎金:" << person1.prize<<endl; cout << "總共:" << person1.total<<endl; // system("PAUSE"); return 0; } -- ┌─────KKCITY─────┐ KKBOX 可立刻 聽音樂 ■ bbs.kkcity.com.tw ■■所有想找的歌通通不必等 ■■ └──From:218.169.114.253 ──┘ http://www.kkbox.com.tw --

04/22 19:54, , 1F
int main()
04/22 19:54, 1F
文章代碼(AID): #16Amzp00 (Programming)
討論串 (同標題文章)
文章代碼(AID): #16Amzp00 (Programming)