Trying to get from the program so that it counts the number of letters and words. Visual Studio displays an error pointing to getche (). Although syntactically, it is used correctly. What is my mistake?
# include & lt; iostream & gt;
# INCLUDE & LT; Conio.h & gt;
Using Namespace STD;
INT MAIN ()
{
int chcount = 0;
INT WDCOUNT = 1;
char ch = 'a';
COUT & LT; & LT; "ENTER THE STRING:";
While (CH! = '\ R')
{
ch = getche ();
if (ch = '')
WDCount ++;
ELSE.
CHCOUNT ++;
}
COUT & LT; & LT; "\ NWORDS" & lt; & lt; WDCount & lt; & lt; Endl;
COUT & LT; & LT; "Letters:" & lt; & lt; (CHCOUNT - 1) & lt; & lt; Endl;
Return 0;
}
Answer 1, Authority 100%
First your error 🙂 – you need not
if (ch = '')
a
if (ch == '')
Second – if there are several gaps in a row, you consider them words …
well, and getche ()
Neither (yes and, in general, in vain you are her, non-standard, use …)