The following code has 16 errors of the same type: error C2106: '=' : left operand must be l-value
The errors are found within points //A and //B.
Could someone show me how to overcome these errors?
Code:
/* LEARN ARITHMETICS is a program designed to train one in arithmetic operations by assigning questions
to the user and giving output depending on whether the answer is right or wrong. */
#include<stdio.h>
#include<stdlib.h>
void randomNumbers();
int main()
{
int one;
int two;
int three;
int four;
int five;
int anOperator, pAnswer, uAnswer, grade;
char signOperator;
printf("LEARN ARITHMETICS\nTo begin;\n\tEnter 1 for Addition\n\tEnter 2 for Subtraction\n\tEnter 3 for Multiplication\n\tEnter 4 for Division\n\tEnter 5 for All\n");
scanf("%d", &anOperator);
printf("Enter your grades;\n\t1 for Grade one\n\t2 for Grade two\n\t3 for Grade three");
scanf("%d", &grade);
if (grade == 1) //A
one = (rand() % 10) & two = (rand() % 10) & three = (rand() % 10) & four = (rand() % 10) & five = (rand() % 10);
else if (grade == 2)
one = (rand() % 100) & two = (rand() % 100) & three = (rand() % 100) & four = (rand() % 100) & five = (rand() % 100);
else one = (rand() % 1000) & two = (rand() % 1000) & three = (rand() % 1000) & four = (rand() % 1000) & five = (rand() % 1000);
do
{
if (anOperator == 1)
pAnswer = one + two & signOperator = '+';
if (anOperator == 2)
pAnswer = one - two & signOperator = '-';
if (anOperator == 3)
pAnswer = one * two & signOperator = '*';
if (anOperator == 4)
pAnswer = one / two && signOperator = '/'; //B
pAnswer = ((((one / two) * three) + four) - five) && (printf("%d / %d * %d + %d - %d = ?", one, two, three, four, five));
printf("%d %c %d = ? (Enter the correct value)\n", one, signOperator, two);
scanf("%d", &uAnswer);
if (uAnswer = pAnswer)
printf("Keep up the good work\n");
printf("No. Please try again\n");
}
while (uAnswer = pAnswer || uAnswer != pAnswer);
return 0;
}
The above program is unfinished.