看板Programming
标 题请教C++与结构
发信站KKCITY (Sun Apr 22 15:21:30 2007)
转信站ptt!ctu-reader!ctu-gate!news.nctu!news.ntu!news.au!zoonews.ee.ntu!news
请教一下,为何
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■■■
--
1F:推 revivalworld:int main() 60.244.26.68 04/22 19:54