首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

哪位高手能帮小弟我找出异常

2012-03-06 
谁能帮我找出错误# includeiostream# includestringusing std::coutusing std::endlusing std::cin

谁能帮我找出错误
# include<iostream>
# include<string>
using std::cout;
using std::endl;
using std::cin;
using std::string;
int main()
{
  string name[100]={0};
float score[100]={0};
int i(0);
int j(0);
int k(0);
float num(0);
char chart(0);
cout<<endl
<<"press # to stop"
<<endl
<<"now please enter students name and their score"
<<endl;
for (i=0;i<100;i++)
{
cout<<"enter the students name:"
<<endl;
std::getline(cin,name[i]);
cout<<"enter the students score:";
cin>>score[i];
j++;
if( name[i]='#')break;
}  
for (k=0;k<j;k++)
{
num+=score[k];
}
cout<<"the average is :"
<<num/j
<<endl;

return 0;
}
这段程序编译后提示我 conditional expression of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' is illegal
这是为什么呢

[解决办法]
能说清楚点吗

热点排行