-6
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

 #define password "Please enter your password"

int main(int arge, char *argv[])
(
  char pass[100];


  printf("Please enter your password\n\n");
  scanf("is", pass);
  if ( stromp(pass, passsword) == 0 )
  (
       printf("Congrats!! Correct Pass\n\n");

  { else}

      printf("Wrong Pass\n\n");
   )

   system("PAUSE");
   return 0;
)       

So I'm not sure what's wrong with it and I've been completely stuck on it for two days now, Whenever I try to compile it I get this:

prog.c:12:3: error: expected declaration specifiers or '...' before 'printf'
       printf("Please enter your password\n\n");
       ^
    prog.c:13:3: error: expected declaration specifiers or '...' before 'scanf'
       scanf("is", pass);

   ^
prog.c:14:3: error: expected declaration specifiers or '...' before 'if'
   if ( stromp(pass, passsword) == 0 )
   ^

prog.c:24:4: error: expected declaration specifiers or '...' before 'return'
    return 0;
    ^

prog.c:7:5: error: 'main' declared as function returning a function
 int main(int arge, char *argv[])
     ^

prog.c: In function 'main':
prog.c:25:1: error: expected '{' at end of input
 )         
 ^


prog.c:25:1: warning: control reaches end of non-void function [-Wreturn-type]
 )         
 ^

Can you show me how it's supposed to be?

Thiyagu
  • 17,362
  • 5
  • 42
  • 79
nume
  • 1
  • 7
    You have basic syntax errors all over your code. You can't really expect us to fix all of them for you. Stackoverflow is not really for that purpose. Perhaps you should take a beginners C course or do a few introductory C tutorials? – kaylum Jul 26 '15 at 05:19
  • start by fixing the function brackets to curly ones, it should make the other errors more understandable, right now your compiler doesn't even understand that's a function. – Leeor Jul 26 '15 at 05:21
  • 4
    First try to write a [hello world](http://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-read) program by reading any C programming book. – mazhar islam Jul 26 '15 at 05:29

2 Answers2

1
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>

  int main(int argc, char *argv[])
  {
     char pass[100];
     char password[]="9009875316";
     printf("Please enter your password\n\n");
     fgets(pass,100,stdin);
     if (!(strcmp(pass, password)))
     {
        printf("Congrats!! Correct Password\n\n");
        // your code if entered password is correct..
     }
     else
     {
        printf("Wrong Password\n\n");
        // your code if entered password is wrong..
     }
     return 0;
  }

Basic_Syntax

Input_Output

Learn C

udit043
  • 1,610
  • 3
  • 22
  • 40
0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define password "Please enter your password"

int main(int arge, char *argv[])
{
    char pass[100];


    printf("Please enter your password\n\n");
    scanf("is", pass);
    if ( strcmp(pass, password) == 0 ) 
    {   
        printf("Congrats!! Correct Pass\n\n");

    } else{

        printf("Wrong Pass\n\n");
    }

    system("PAUSE");
    return 0;
}
Liyuan Liu
  • 172
  • 2