编程错误
编程错误提示如下:错误 1 error C2664: “std::basic_istream<char,std::char_traits<char>> &std::basic_istream<char,std::char_traits<char>>::get(std::basic_streambuf<char,std::char_traits<char>> &,_Elem)”: 无法将参数 1 从“char”转换为“char *” c:\users\think\documents\visual studio 2013\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp 10 1 ConsoleApplication1错误 2 error C2664: “void strcount(const char *)”: 无法将参数 1 从“char”转换为“const char *” c:\users\think\documents\visual studio 2013\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp 16 1 ConsoleApplication1
4 IntelliSense: 没有与参数列表匹配的 重载函数 "std::basic_istream<_Elem, _Traits>::get [其中 _Elem=char, _Traits=std::char_traits<char>]" 实例
参数类型为: (char, const int)
对象类型是: std::istream c:\Users\THINK\Documents\Visual Studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.cpp 10 5 ConsoleApplication1
应该怎么改??大家帮忙看看
#include<iostream>
const int ArSize = 10;
void strcount(const char * str);
int main()
{
using namespace std;
char input(ArSize);
char next;
cout << "Enter a line:\n";
cin.get(input, ArSize);
while (cin)
{
cin.get(next);
while (next != '\n')
cin.get(next);
strcount(input);
cout << "Enter next line (empty line to quit):\n";
cin.get(input, ArSize);
}
cout << "Bye\n";
return 0;
}
void strcount(const char * str)
{
using namespace std;
static int total = 0;
int count = 0;
cout << "\"" << str << "\"contains";
while (*str++)
count++;
total += count;
cout << count << " characters\n";
cout << total << " characters total\n";
}