Thread: declaration terminated incorrcetly

  1. #1
    Registered User
    Join Date
    May 2016
    Posts
    4

    declaration terminated incorrcetly

    in line 57 I am getting this error



    Code:
    #include<stdio.h>
    #include<string.h>
    #include<conio.h>
    #include<iostream>
    #include<stdlib.h>
    
    int main()
    {
        char userId[10],passwrd[10];
        char uoid[] = "MIS",opasswrd[] = "123";
        int chances = 3;
    
    
        while (chances)
        {
            printf("Enter User ID -> ");
            scanf("%s", userId);
            printf("\n");
            printf("Enter Your Password -> ");
            scanf("%s", passwrd);
    
            if (strcmp(uoid, userId) == 0 && strcmp(passwrd, opasswrd) == 0)
            {
                printf("Correct User Id And Password\n");
                break;
            }
            else
            {
                printf("Invalid User Id And Password\n\n");
                chances--;
    
                if(!chances)
                {
                    printf("You have no more chances...\n");
                    printf("Do you want to register y/n -> ");
    
                    printf("\n");
    
    
                    {
                        printf("Enter your new ID -> ");
                        scanf("%s",uoid);
                        printf("Enter your new PW -> ");
                        scanf("%s",opasswrd);
    
                        chances = 3;
                    }
                }
            }
        }
    
        clrscr();
    
    
    }
    
    {
    	char choice;
    	char c[50];
    	char id[50];
    	char age[50];
    	char last[100];
    	char first[100];
    	char dep[50];
    	char add[50];
    
    b:
    	clrscr();
    	printf("=====PROGRAM MENU=====");
    	printf("\n\n[1] = CIRCLE AREA");
    	printf("\n[2] = RECTANGLE AREA");
    	printf("\n[3] = TRIANGLE AREA");
    	printf("\n[4] = LAST GRADE");
    	printf("\n[5] = LETTER GRADE");
    	printf("\n[6] = FACTORIAL");
    	printf("\n[7] = PRINTING");
       printf("\n[8] = Exit Program");
    	printf("\n\nChoice : ");
    	scanf("%d",&choice);
    	switch (choice)
    	{
    	case 1:
    		clrscr();
    		FILE * f;
    
    		f=fopen("test.txt","r+");
    		if(f==NULL){
    			printf("No Database");
    			exit(1);
    }
    
    	getch();
    }

  2. #2
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528
    Quote Originally Posted by Zaid Mashni View Post
    in line 57 I am getting this error
    What are you trying to do ? Did you just copy paste this code from somewhere else because if so, unfortunately we might not be able help.

  3. #3
    Registered User
    Join Date
    May 2016
    Posts
    4
    Quote Originally Posted by Aslaville View Post
    What are you trying to do ? Did you just copy paste this code from somewhere else because if so, unfortunately we might not be able help.
    I am trying to add password and username to program menu
    no I didn't copy
    Last edited by Zaid Mashni; 05-11-2016 at 02:09 PM. Reason: blamed for copying

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    You have a closing brace on line 55, which balances the start of main on line 8.

    Asked and answered here as well -> deceleration terminated and - C++ Forum
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    All C++ I see is <iostream>, but it's not used anywhere, so I don't see how this is C++ at all.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help soon: declaration terminated incorrectly
    By nizwa_hazel in forum C++ Programming
    Replies: 4
    Last Post: 01-17-2013, 11:23 PM
  2. bcc 5.5 Declaration terminated incorrectly
    By P4R4N01D in forum Windows Programming
    Replies: 9
    Last Post: 05-28-2008, 04:45 PM
  3. error declaration terminated incorrectly help
    By belfour in forum C++ Programming
    Replies: 7
    Last Post: 11-25-2002, 09:07 PM
  4. Declaration terminated incorrectly
    By Griffin2020 in forum C Programming
    Replies: 8
    Last Post: 04-26-2002, 11:53 PM
  5. declaration terminated incorrectly
    By Clane in forum C++ Programming
    Replies: 4
    Last Post: 03-08-2002, 12:09 AM

Tags for this Thread