cpp
#include <string.h>
#include <stdio.h>
#include <iostream.h>
FILE *input, *output;
char myStr[100], myTmp[100];
int iden=1, index=0;
void main()
{
input = fopen("c:/Project/p1.in.txt","r");
output = fopen("c:/Project/p1.out.txt","w");
if (input == NULL)
{
cout << "Error opening the file!\n\n";
}
else
{
while (!feof(input))
{
char getChar = fgetc(input);
if (getChar != '\n')
{
if (iden != 1)
{
myStr[index] = getChar;
index++;
}
}
else
{
if (iden != 1)
{
myStr[index] = NULL;
index=0;
strcpy(myTmp,myStr);
strrev(myTmp);
if (strcmp(myTmp,myStr) == 0)
{
cout << myStr << " - TRUE\n";
fwrite("TRUE\n",5,1,output);
}
else
{
cout << myStr << " - FALSE\n";
fwrite("FALSE\n",6,1,output);
}
}
iden++;
}
}
fclose(input);
fclose(output);
}
}
guys the INPUT in this program is:
3
yehey
anamarie
no devil lived
if i will change to the INPUT like this:
4
yehey
anamarie
no devil lived on
maam
guys the INPUT that i will change is will function this program? coz many times that i wll change the INPUT still the same the INPUT :
3
yehey
anamarie
no devil lived on
guys need INFo about this?
MOD EDIT: Please
Thanks, gabehabe