1   1  /  1  页   跳转

【求助】c++新手问题!

【求助】c++新手问题!

#include "stdafx.h"
#include "stdio.h"
#include "string.h"
#include "iostream.h"

struct stu{
int sum;char name[10];
};

int main(int argc, char* argv[])
{
    stu student[10];
    student[10].name="quyouli";//编译出错,提示不能把8个字符放到10个字符的变量里...
    student[10].sum=12;
    cout<<student[10].name<<student[10].sum<<endl;
   
    return 0;
}

//请问怎么做才能让student[10].name被输入各种小于11长度的字符串?
最后编辑2007-04-07 22:13:30
分享到:
gototop
 

明白了,用strcpy函数就能搞定。
新的问题又有了:
请问left operand must be l-value
是什么意思?
gototop
 
1   1  /  1  页   跳转
页面顶部
Powered by Discuz!NT