請教C++與結構
請教一下,為何
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
04/22 19:54, 1F
討論串 (同標題文章)
Programming 近期熱門文章
PTT數位生活區 即時熱門文章