老師,請(qǐng)幫我看看代碼到底錯(cuò)在哪了吧
#include<iostream>
#include<stdlib.h>
#include<string>
using namespace std;
int main()
{
string name; // 1
cout<<"please input your name:"; ?// 2
getline(cin,name);
if(name.empty()) //6
{
cout<<"input is null.."<<endl;
system("pause");
? ?return 0;
}
if(name=="imooc") //7
{
cout<<"you are an administrator"<<endl;
}
cout<<"hello" + name<<endl; ?//3
cout<<"your name length:"<<name.size<<endl; //4
cout<<"your name fisrt lettor is:"<<name[0]<<endl; //5
system("pause");
return 0;
}
2016-03-08
name.size(),你漏掉size()函數(shù)的括號(hào)了
2016-03-06
我的運(yùn)行結(jié)果是這樣的,,,