By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,983 Members | 1,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,983 IT Pros & Developers. It's quick & easy.

expression syntax error

P: 1
Expression syntax error occurs in this program.

Please help me as soon as possible.


Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<string.h>
  4. void main()
  5. {
  6.      char pwrd[]="admin123";
  7.      char temp1[25] , temp2[25] , uname[]="admin" , ch;
  8.      int i=0 ,k,j,l;
  9.      clrscr();
  10.      printf("Enter the username: ");
  11.      gets(temp1);
  12.      printf("Enter the password:");
  13.      while(1)
  14.   {
  15.    ch=getch();
  16.    if(ch==13)
  17.       break;
  18.    printf("*");
  19.      temp2[i++]=ch;
  20.    }
  21.      temp2[i]='\0';                                                               //5
  22.      if(!strcmp(uname,temp1)&&!strcmp(temp2,pwrd))
  23.     {
  24.     printf("\nWelcome to Admin Portal\n");
  25.     }
  26.  
  27.     printf("\nSelect with what you want to go ahead\n1.Supplier's details\n2.Product details\n 3.Database of sales\n");
  28.     scanf("%d",&k);
  29.     if (k==1)
  30.     {
  31.     printf("\nSelectone supplier\n1.abc stores\n2.xyz stores \n3.qwe stores\n");
  32.     scanf("%d",&j);
  33.  
  34.    if (j===1)
  35.    {
  36.    printf("store location is gurukul road\n the store is for books\n owner of the stor is madhur patel");
  37.    }
  38.   else if (j==2)
  39.   {
  40.   printf("\nstore locatin is sg highway\n the store is for food\n owner of the stor is soham pattel");
  41.   }
  42.  
  43.   else if (j==3)
  44.   {
  45.   printf("\nstore locatin is cg road\n the store is for mobile\n owner of the store is rutvik patel");
  46.   }
  47.  
  48.    }
  49.    }
  50.    if(k==2)
  51.     {
  52.  
  53.     printf("\nselsecct product\n1.moto g4\n2.samsung s3 \n3.our suggetion\n");
  54.     scanf("%d",&l);
  55.  
  56.     if(l==1)
  57.     {
  58.     printf("\n MOTO G4 is from motorola\n MOTO G4 have 3 gb ram \nMOTO G4 have 32 gb rom\n and many more.......\n");
  59.  
  60.    }
  61.  
  62.    else if(l==2)
  63.    {
  64.      printf("\n samsung s3 is from samsung\n samsung s3 have 2 gb ram \n samsung  s3 have 16 gb rom and many more......\n");
  65.    }
  66.  
  67.     else if(l==3)
  68.     {
  69.     printf("\n We suggest you a iphone 7 \n buy that if youu can afford\n");
  70.     }
  71.  
  72.  
  73.  
  74.     if(k==3)
  75.     {
  76.     printf("\nData base of sale is \n1.2011-2012-33% benifit \n2.2012-2013-20% of loss \n3.2013-2014-40% benifit\n4.2015-2016-38% benifit\n");
  77.     }
  78.  
  79.     else
  80.     {
  81.     printf("\nPlease enter correct password");
  82.      }
  83.     getch();
  84.  
  85.  
  86.  
  87.  
  88.  }
  89.  
  90. }
Nov 30 '16 #1
Share this Question
Share on Google+
1 Reply


Frinavale
Expert Mod 5K+
P: 9,731
If you go through your code and attempt to add proper indentation you will see that you are missing opening and closing brackets {}.

When I say proper indentation I mean every time you have an open bracket { the block of code (lines of code) inside should be indented until you meet it's corresponding closing bracket }.

Once you have done this, try to compile your application. At that point, if you still see errors, post a reply to this thread with the updated code and with the new error message so that you can get more help.

(Please remember to use the [code/] button when posting code)
Nov 30 '16 #2

Post your reply

Sign in to post your reply or Sign up for a free account.