1839 | 2022-12-04 18:58:20 | peter | Kvázi-Izogram | cpp17 | Compilation error |
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main()
{
int mondatokszama;
scanf("%d\n", &mondatokszama);
char** mondat = (char**)malloc(sizeof(char*) * mondatokszama);
for (int i = 0; i < mondatokszama; i++)
{
mondat[i] = (char*)malloc(sizeof(char) * 101);
fgets(mondat[i], 101, stdin);
}
int isogram = mondatokszama;
for (int i = 0; i < mondatokszama; i++)
{
for (int j = 0; j < strlen(mondat[i]) - 1; j++)
{
int db = 1;
for (int k = j + 1; k < strlen(mondat[i]); k++)
{
if (tolower(mondat[i][j]) == tolower(mondat[i][k]) && (mondat[i][j] >= 'A' && mondat[i][j] =< 'Z' || mondat[i][j] >= 'a' && mondat[i][j] =< 'z'))
{
db++;
}
}
if (db > 2)
{
isogram--;
}
}
}
printf("%d", isogram);
free(mondat);
return 0;
}
exit status 1
main.cpp: In function 'int main()':
main.cpp:27:109: error: expected primary-expression before '<' token
27 | if (tolower(mondat[i][j]) == tolower(mondat[i][k]) && (mondat[i][j] >= 'A' && mondat[i][j] =< 'Z' || mondat[i][j] >= 'a' && mondat[i][j] =< 'z'))
| ^
main.cpp:27:155: error: expected primary-expression before '<' token
27 | if (tolower(mondat[i][j]) == tolower(mondat[i][k]) && (mondat[i][j] >= 'A' && mondat[i][j] =< 'Z' || mondat[i][j] >= 'a' && mondat[i][j] =< 'z'))
| ^
main.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
10 | scanf("%d\n", &mondatokszama);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~...