Why won't my program compile?

This is a discussion on Why won't my program compile? within the C++ Programming forums, part of the General Programming Boards category; ----------------------------------------------------------------------------------- /* Name: Zero Guess By: Ground Zero Unit(Golden Bunny) Engine Started: May 03,2002 Engine Updated: May 03,2002 */ #include ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    156

    Why won't my program compile?

    -----------------------------------------------------------------------------------
    /*
    Name: Zero Guess
    By: Ground Zero Unit(Golden Bunny)
    Engine Started: May 03,2002
    Engine Updated: May 03,2002
    */

    #include <iostream>
    #include <fstream.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    #include <string>
    #include <windows.h>

    #define data "data.dat"

    void game();

    int main()
    {
    bool bStillPlaying=true;
    int response;

    while (bStillPlaying) {
    printf("\t\t**********************\n");
    printf("\t\t** 1. Introduction **\n");
    printf("\t\t** 2. Start Game **\n");
    printf("\t\t** 3. Exit **\n");
    printf("\t\t**********************\n");
    printf("\t\tWhat is Thy Desire?\n ");
    scanf("%i", response);

    switch(response) {
    case 1:
    printf("\tZero Guess is one of the many side projects by Ground Zero.\n");
    printf(" Not much to say about this title. Its just a slot game. Simply\n");
    printf(" pick a difficulty level and in a few seconds the CPU will inform\n");
    printf(" you what the maximum number will be. Its just a simple game. Nothing\n");
    printf(" too special about this title. Just a quick game that took me 10 minutes\n");
    printf(" to make. Enjoy!!!");
    return 0;
    break;
    case 2:
    game();
    break;
    case 3: bStillPlaying=false;
    break;
    default: printf("Sorry, couldn't understand that input. Bailing out.");
    bStillPlaying=false;
    break; }

    cin.get();
    return 0;
    }

    void game()
    {
    int pick, ez=0, norm=0, complex=0, life=5, sjob;
    printf("\t1. Easy\n");
    printf("\t2. Medium\n");
    printf("\t3. Hard\n");
    printf("\tWhat is Thy Desire? ");
    scanf("%i", pick);

    switch(pick) {
    case 1:
    printf("\nPlease wait while we search for the maximum number.");
    for (int i=0;i<=16;i++) {
    printf("-"); Sleep(200); }
    printf("\n");

    ifstream x(data);
    x >> ez;
    printf("The Maximum Number will be: %i", ez);
    int right=rand() % ez;
    x.close();

    for (int z=life;z<=9;z++) {
    printf("\nInput your guess: ");
    scanf("%i", sjob);

    if (sjob>=ez) {
    printf("\nYou're higher than the number!!"); }

    else if (sjob<=ez) {
    printf("\nYou're lower than the number!!"); }

    else if (sjob==ez) {
    printf("\nYou're right!!"); }

    else if (z==9) {
    printf("\nThe correct answer was: %i", ez); }
    }
    printf("Game Over");
    break;

    case 2:
    printf("\nPlease wait while we search for the maximum number.");
    for (int i=0;i<=16;i++) {
    printf("-"); Sleep(200); }
    printf("\n");

    ifstream x(data);
    x >> ez;
    x >> norm;
    printf("The Maximum Number will be: %i", norm);
    int right=rand() % norm;
    x.close();

    for (int z=life;z<=9;z++) {
    printf("\nInput your guess: ";
    scanf("%i", sjob);

    if (sjob>=norm) {
    printf("\nYou're higher than the number!!"); }

    else if (sjob<=norm) {
    printf("\nYou're lower than the number!!"); }

    else if (sjob==norm) {
    printf("\nYou're right!!"); }

    else if (z==9) {
    printf("\nThe correct answer was: %i", norm); }
    }
    printf("Game Over");
    break;

    case 3:
    printf("\nPlease wait while we search for the maximum number.");
    for (int i=0;i<=16;i++) {
    printf("-"); Sleep(200); }
    printf("\n");

    ifstream x(data);
    x >> ez;
    x >> norm;
    x >> complex;
    printf("The Maximum Number will be: %i", complex);
    int right=rand() % complex;
    x.close();

    for (int z=life;z<=9;z++) {
    printf("\nInput your guess: ";
    scanf("%i", sjob);

    if (sjob>=complex) {
    printf("\nYou're higher than the number!!"); }

    else if (sjob<=complex) {
    printf("\nYou're lower than the number!!"); }

    else if (sjob==complex) {
    printf("\nYou're right!!"); }

    else if (z==9) {
    printf("\nThe correct answer was: %i", complex); }
    }
    printf("Game Over");
    break;
    default: printf("\nSorry, couldn't understand that input. Bailing out.");
    break; }
    }
    -----------------------------------------------------------------------------------
    Last edited by Golden Bunny; 05-04-2002 at 10:07 PM.
    Compiler: MingW(IDE: Bloodshed Dev-C++ 4.01)
    Web Site: Zoo Crew
    Forums: Zoo Boards
    E-mail: goldenbunny84@hotmail.com

    "Do you wanna go to jail or do you wanna go home?!?!" - Alonzo(Training Day)

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    Because you take no care of it, grasshopper. If you cared for it you'd put it in code tags for all to read with consumate ease. But if you you cared for it enough to put in code tags then it may be correct in the first place.

  3. #3
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    Is it just me or do you put no effort in debugging your own applications?
    What section of the code is causing problems?

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    156
    forget it, no one wants to help
    Compiler: MingW(IDE: Bloodshed Dev-C++ 4.01)
    Web Site: Zoo Crew
    Forums: Zoo Boards
    E-mail: goldenbunny84@hotmail.com

    "Do you wanna go to jail or do you wanna go home?!?!" - Alonzo(Training Day)

  5. #5
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    I'm sorry, maybe if you made a little freaking effort yourself others would help you.

    Help me help you Golden Bunny. Help ME, help YOU.

  6. #6
    You are busted
    Guest
    Cleaning up my harddrive today I found your (Golden Bunny/Ruflano) little stalker.txt file. Not that I care, because I know you can't code your way out of a paperbag and therefor aren't a hack threat. Just wanted to let everyone know what a putz you are.

    This is what is included in his little stalker.txt file he sent to me:

    ** begin crap **

    After you read this file, e-mail it to me so that I could hunt you down!!
    Ruflano@hotmail.com hahahahah, e-mail me. I'm a stalker!!! hahaha!!
    Username: ***editted***
    Age: ***editted***

    ** end crap **

    You are a punk who doesn't deserve help.

  7. #7
    Registered User
    Join Date
    Apr 2002
    Posts
    156
    I already stated the problems. It won't compile. If you try compiling it yourself you'll see the compiling errors. I read them and they don't make sense. It said that bjob, ez, and life are underclared. Which makes no freakin sense at all because I declared it in void gamer();
    Compiler: MingW(IDE: Bloodshed Dev-C++ 4.01)
    Web Site: Zoo Crew
    Forums: Zoo Boards
    E-mail: goldenbunny84@hotmail.com

    "Do you wanna go to jail or do you wanna go home?!?!" - Alonzo(Training Day)

  8. #8
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    1. Repost your code with Code tags.
    2. Post your compile errors.

    "It won't compile" is not the problem. The problem is numerous other errors which lead it to not compiling.

  9. #9
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    >>Why won't my program compile?

    Because you didn't use code tags.

  10. #10
    Registered User
    Join Date
    Apr 2002
    Posts
    95
    This can be a harsh board for newbies especially if they forget the two golden rules code tags and reading the faq.

    Golden Bunny you can edit your post to include code tags, which makes it easier to read.

    Keep with it!

  11. #11
    Shadow12345
    Guest
    golden bunny isn't a newbie, ok he forgot to use freaking code tags. what if he only posted the section of code that he thought contained the errors, but the errrors were in fact generated somewhere else? in that case no one would be able to help him without more code. I truly AM a newbie and I could read through his code fine, and I understood it, so I don't see why you senior members can't.

  12. #12
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    Originally posted by rip1968
    This can be a harsh board for newbies
    No it isn't. You obviously don't know the Golden Bunny very well.
    You don't just post 129 lines of code and ask "Why won't this compile?". Plus GbonnyRuflanoBunny is definitely not a newbie. Counting his aliases he's got about 200 posts (including the times he replied to himself under a different name). This kid's got a history.

    Not too mention he's a (wannabe) stalker.


    As far as the golden rules (as you call them), I have helped plenty of people who didn't use code tags. I will put something like:
    "Please use code tags" in my reply though to encourage them. GB, however, doesn't warrant this courtesy.

  13. #13
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Well just make them global. Think a little!

  14. #14
    Registered User Prodigy's Avatar
    Join Date
    May 2002
    Posts
    25
    Ah i love...

    CODE TAGS

    And the cows moo...
    AIM:ProdigyCpp
    E-Mail:ProdigyMan911@aol.com
    If you like my avatar plz dont copy it go to:
    http://www.dragid.com/

  15. #15
    Registered User
    Join Date
    Apr 2002
    Posts
    156
    how do I make code tags?
    Compiler: MingW(IDE: Bloodshed Dev-C++ 4.01)
    Web Site: Zoo Crew
    Forums: Zoo Boards
    E-mail: goldenbunny84@hotmail.com

    "Do you wanna go to jail or do you wanna go home?!?!" - Alonzo(Training Day)

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 02:42 AM
  2. Compile Public Domain Pocket PC C Program
    By m1l in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 07-20-2007, 05:02 AM
  3. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 01:27 PM
  4. new to C--can't get program to compile
    By samerune in forum C Programming
    Replies: 12
    Last Post: 04-02-2007, 10:44 AM
  5. how do i compile a program that deals w/classes?
    By Shy_girl_311 in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2001, 02:32 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21