我对C ++还是很陌生,我刚刚完成了有关类的学习。我不知道为什么我不断收到此错误C4244(检查标题)。 我正在使用Visual Studio 2017 反馈将不胜感激。
//我的程序要求用户输入一个句子 `
#include <iostream>
using namespace std
Const short MAX = 132;
class information
{
char sentence[MAX];
short gcount;
public:
unsigned short CharCount;
void InputData();
void showresult();
};
Int main()
{
Information data;
data.InputData();
data.showresult();
return 0;
}
void information::InputData()//member function to enter info
{
cin.ignore(10,'\n');
cout << "Enter your sentence " << endl;
cout << endl;
cin.getline(sentence,sizeof(sentence));
CharCount = cin.gcount(); // this is the problem
}
void information::showresult() //show number of characters
{
cout << " Characters in the sentence:: " << CharCount << endl;
system(“Pause”);
}
`