I've got to:4. Write a program that asks the user for two strings. The program should then compare the strings and display a message saying whether they are equal or if not, and which one is first alphabetically.
For some reason it doesn't print out the parts in the if statements. Where have I gone wrong?
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
int main()
{
char word1[50];
char word2[50];
int value=0;
printf("please enter the first string\n");
fflush(stdin);
gets(word1);
printf("please enter the second string\n");
fflush(stdin);
gets(word2);
value=strcmp(word1,word2);
if (value=0)
{
printf("the words are exactly the same\n");
}
else if (value>0)
{
printf("%s is alphabeticly first then %s\n",word2,word1);
}
else if (value<0)
{
printf("%s is alphabeticly first then %s\n",word1,word2);
}
system("pause");
}