Microsoft Visual Studio 2017 C++
Problem is that code do not read text that is in the file MVS point by red wave test.txt and in dialog box is written: argument of type "const char" is incompatible with parameter of type char
File is in the project folder////
//
#include "stdafx.h"
#include "stdlib.h"
# include <fstream>
#include <stdio.h>
void HowManyWords(char FileName[]) {
FILE*file = fopen(FileName, "rt");
//if (!file)return false;
int count = 0;
char str[100];
while (fgets(str, 100, file)) {
for (int i = 0; str[i]; i++) {
if (str[i] >= 'A'&&str[i] <= 'Z' || str[i] >= 'a'&&str[i] <= 'z') {
if (str[i + 1] >= 'A'&&str[i + 1] <= 'Z' || str[i + 1] >= 'a'&&str[i + 1] <= 'z') {
}
else {
count++;
}
}
}
printf("%s", str);
}
fclose(file);
printf("%i", count);
}
int main()
{
HowManyWords("test.txt");
printf("\n");
system("pause");
return 0;
}
//111 words
Problem.