Hi guys
I actually have this assignment that I have to complete:
Write a C program to ask the user to input an arithmetic expression and store the expression in an array of t records containing the expression, its value and level of difficulty.The user can terminate the input by just pressing <ENTER>
After inputting , the program will print out all the expressions and their level of difficulty entered by the user.
This is my program code:
#include <stdio.h>
#include <stdlib.h>
#define SIZE 10
struct game{
char exp[10];
short value;
short level;
}quest[SIZE];
void main(){
int count,i;
for(count=0;count<SIZE;count++){
printf("Please enter the expression:");
scanf("%s \n",&quest[count].exp);
printf("Please enter the value of the expression:");
scanf("%d \n",&quest[count].value);
printf("Please enter the level of difficulty:");
scanf("%d",&quest[count].level);
if(quest[count].exp != '\n');
break;
}
for(i=0;i<count;i++){
printf("%c %d %d \n",quest.exp,quest.level);
}
}
And belive me I have tried but this just doesn't seem to be working before at least it printed out the first three statements took the input but now it's nowt even doing that it just prints the first statement after that no matter how many times you press enter it doesn't work!!!!
Please see if you can help me sort it out immediately...it's due tom!!!!THX