I am trying to learn c Language, and I have to create a calculator, the thing is, if I don't type anything and press the enter key it should print out an error, I have tried to do it with scanf but it is not working.
#include <stdio.h>
#include <stdlib.h>
int main()
{
    float a,b,c;
    char op;
    int q=1;
    while(q=1){
   scanf("%f%c%f",&a,&op,&b);
    if (scanf("%f%c%f",&a,&op,&b)=='\n')
    {
        printf("error");
    }
switch (op)
    {
        case '+':c=a+b;
        break;
        case '-':c=a-b;
        break;
        case'*':c=a*b;
        break;
        case'/':c=a/b;
        break;
        default:printf("error");
        q=2;
        break;
    }
    {printf("%f\n",c);}
}}
 
     
    