Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Linker Errors, i do believe i need help #3527
    AnnelieSchoenhe
    Participant

    Wait, so the first else after the initial if should be if followed by a else Which is the second else in the statement right?

    if(exit=3)
    {.....
    }

    //This is where i'm confused
    //This is where the else if should be first right? Then an else should be right after it?
    else if(exit==23){
    ...
    }
    else(exit==46){
    ...
    }

    And even after that, i still recive errors up the ass. I built this code form the floor. How did these codes slip past?

    in reply to: Linker Errors, i do believe i need help #3525
    AnnelieSchoenhe
    Participant

    Before i start, i fortunetly was able to fix the Linker errors. I fear i may have more of them later, but when that time comes, i’ll fix them. Now i have new errors.

    //A basic two in one program used for studying functions and arithmatic.
    //Created by Deathscreton on 5:08 PM 3/20/09
    #include

    addition()
    { do
    {
    char counter,addy,back,exit,yes,no;
    int count;
    int a;
    int b;
    int sum;
    count=0;
    counter='d';
    addy='g';
    back='f';
    exit='k';
    yes='n';
    ++count;

    printf("Please enter the first number: n");
    scanf("%d",&a);
    printf("You've entered %d, is this correct? Y for yes, n for no.",a);
    scanf("%c %c",&yes, &no);
    if (yes=='y')
    {
    printf("Please enter the second number: n");
    scanf("%d",&b);
    printf("You've entered %d, is this correct? y for yes, n for no.",b);
    scanf("%c %c",&yes, &no);
    if (yes=='y')
    {
    sum=a+b;
    printf("The answer of the numbers entered is %d. Would you like to run this again?",sum);
    scanf("%c %c",&yes, &no);
    if (yes=='y')
    {
    addition();
    }
    else (no=='n');
    {
    main();}
    }
    else (no=='n');
    {
    addition();
    }
    }
    }while (count < 48793);

    }



    counting()
    {

    do
    {
    int count;
    char yes;
    char no;
    char exit;
    exit='e';
    count=-89898;
    yes='h';
    no='b';
    printf("Press 'x' to exit the counter, press any other key to start. n");
    scanf("%c",&exit);
    if (exit=='x')
    { break;}
    do
    {
    ++count;
    printf("The counter is now at %d n",count);
    }while (count < 898989);
    printf("The final count number is %d n",count);
    printf("Would you like to run the counter again? y for yes n for no.");
    scanf("%c %c",&yes,&no);
    if (yes=='y');
    {counting();}
    else (no=='n');
    {main();}
    }while (exit=='b');
    }
    }


    int main()
    {
    char start;
    char counter;
    char addy;
    char back;
    char exit;
    char yes;
    char no;
    int count;
    int a;
    int b;
    int sum;
    count=-897989;
    counter='d';
    addy='g';
    back='f';
    exit='k';
    yes='n';
    start='o';

    printf("Welcome to the Basic two in one program created by Deathscreton(a small time coder on his way to PSP homebrew.) n");
    printf("This Basic two-in-one program contains a primative addition calculator and a high sped up counter from the numeric number -897989 to +48793. n");
    printf("You will now be prompted to chose the Addition calculator, or the counter. n");
    printf("For the addition calculator, press a then enter. For the counter, press c then enter. To exit the program, press x then enter. n");
    scanf("%c %c",&addy,&counter,&exit);
    if (addy=='a')
    {addition();}
    else (counter=='c');
    {counting();}
    else (exit=='x')
    {break;}
    return 0;}

    Thats the code, now here are the current errors:


    In function ‘addition’:
    Line 49 :’count’ undeclared (first use in this function
    (Each undeclated identifier is reported only once
    for each function it appears in.)
    In function ‘counting’:
    Line 82: syntax error before “else”
    Line 84: ‘exit’ undeclared(first use in this function)
    At top level:
    Line 86: syntax error before ‘}’ token
    In function ‘main’:
    Line 119: syntax error before “else”


    Those are the errors. I don’t understand why the pop up. I fix one, and another two take that one’s place. What in the world is going on?

Viewing 2 posts - 1 through 2 (of 2 total)