Raised This Month: $ Target: $400
 0% 

C++ help..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 04-20-2007 , 20:47   C++ help..
Reply With Quote #1

Well.. I'm currently having the issue with wondering how to display all three choices in the beginning.
Like for Example:

Code:
Pick an option:
1
2
3
if option 1 picked display the cs4$ if 2 display only Mo0se Community an 3 display only theend.


But i did mine in ifstatements mostly.. I thought i could get around it but i got lost. Here's my current Source Code:
It compiles correctly but doesnt do what i wanted it to do.. Help would be appreciated. Also i'm uploading the .exe file so an can see the software in action..
__________________
i stop around here and there.

Last edited by Da_sk8rboy; 04-22-2007 at 17:51.
Da_sk8rboy is offline
LittleDude
Member
Join Date: Dec 2004
Location: Selah, WA
Old 04-20-2007 , 21:28   Re: C++ help..
Reply With Quote #2

try something like this, i dunno if the syntax is right or not though

PHP Code:
#include <iostream>

using namespace std;

void ShowFirstOption();
void ShowSecondOption();
void ShowThirdOption();

int main()
{

    
int choice;

    
cout << "This is a menu to pick choices" << endl;

    
cin >> choice;

    if( 
choice || choice )
    {
        exit(
0);
    }
    else
    {

    switch(
choice)
    {
        case 
1ShowFirstOption();
        break;
        
        case 
2ShowSecondOption();
        break;
        
        case 
3ShowThirdOption();
        break;

        default: exit(
0);
        break;
    }
    }

    return 
0;
}

void ShowFirstOption()
{
    
cout << "This is the first option" << endl;
}

void ShowSecondOption()
{
    
cout << "This is the second option" << endl;
}

void ShowThirdOption()
{
    
cout << "This is the third option" << endl;

__________________
It is stupid to be stupid, and stupid to not be stupid
LittleDude is offline
Send a message via AIM to LittleDude
Old 04-20-2007, 21:36
Da_sk8rboy
This message has been deleted by Da_sk8rboy.
LittleDude
Member
Join Date: Dec 2004
Location: Selah, WA
Old 04-20-2007 , 21:42   Re: C++ help..
Reply With Quote #3

ya but right after that part you say cout << "1: Show First Option Information" << endl; or whatever and cout << "2: Show Whatever Else" << endl; and cout << "3: Option 3 Information" << endl;

you gotta add that too it and if they pick option 1-3 it should go to those functions, and if you pick option 0 it should quit

also it checks if they entered any numbers less than 0 or greater than 3 which you dont even need, because the default case handles it anyway but do you get what im saying?

ill edit this in a sec to show you what i mean
__________________
It is stupid to be stupid, and stupid to not be stupid
LittleDude is offline
Send a message via AIM to LittleDude
LittleDude
Member
Join Date: Dec 2004
Location: Selah, WA
Old 04-20-2007 , 21:44   Re: C++ help..
Reply With Quote #4

Here ill just edit this, sorry for double post but whatever

PHP Code:
#include <iostream>

using namespace std;

void ShowFirstOption();
void ShowSecondOption();
void ShowThirdOption();

int main()
{

    
int choice;

    
cout << "\tThis is a menu to pick choices" << endl;
            
cout << "1: This is option 1" << endl;
            
cout << "2: This is option 2" << endl;
            
cout << "3: This is option 3" << endl;
            
cout << "0: Exit" << endl;

    
cin >> choice;

    
/*if( choice < 0 || choice > 3 ) // dont really need to check this because the default case will handle it
    {
        exit(0);
    }
    else
    {*/

    
switch(choice)
    {
        case 
1ShowFirstOption();
        break;
        
        case 
2ShowSecondOption();
        break;
        
        case 
3ShowThirdOption();
        break;

        default: exit(
0);
        break;
    }
    }

    return 
0;
}

void ShowFirstOption()
{
    
cout << "This is the first option" << endl;
}

void ShowSecondOption()
{
    
cout << "This is the second option" << endl;
}

void ShowThirdOption()
{
    
cout << "This is the third option" << endl;

__________________
It is stupid to be stupid, and stupid to not be stupid
LittleDude is offline
Send a message via AIM to LittleDude
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 04-20-2007 , 22:44   Re: C++ help..
Reply With Quote #5

hmm. when i click to display it it shut's the program down.
EDIT:
nevermind.. i just added a system("PAUSE")
__________________
i stop around here and there.
Da_sk8rboy is offline
LittleDude
Member
Join Date: Dec 2004
Location: Selah, WA
Old 04-20-2007 , 22:56   Re: C++ help..
Reply With Quote #6

so it works?
__________________
It is stupid to be stupid, and stupid to not be stupid
LittleDude is offline
Send a message via AIM to LittleDude
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 04-20-2007 , 23:06   Re: C++ help..
Reply With Quote #7

not completely done with it.
__________________
i stop around here and there.
Da_sk8rboy is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 04-21-2007 , 12:38   Re: C++ help..
Reply With Quote #8

What's the point of this program? Or future use if any.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 04-22-2007 , 00:14   Re: C++ help..
Reply With Quote #9

It looks like he's trying to do something called learnding.

stupok is offline
Old 04-22-2007, 16:45
Da_sk8rboy
This message has been deleted by Da_sk8rboy. Reason: i got it. thnx little dude
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 04-22-2007 , 18:01   Re: C++ help..
Reply With Quote #10

Quote:
Originally Posted by LittleDude View Post
so it works?
Yes. i got it to work, but now i'm wondering another thing.
When you select a choice it displays the output. Then it say's:
"Press any key to close..." or whatever. How can i add the other 3 choices instead of press any key to close.."

LIke ex:

YOU'VE SELECTED #2

blah blah blah

1. CS4$
3. Credits
4. Program info
0. Exit


(Like what im saying if you dont understand is, after you have already selected one an the output has came up on the program, under it bring the menu choice back up then after you've completely gone through the menu choices be able to press any key to close.

Here's the code now:

Code:
#include <iostream>

using namespace std;

void ShowFirstOption();
void ShowSecondOption();
void ShowThirdOption();
void ShowFourthOption();

int main()
{

    int choice;

    cout << "\t\n\n+-----------------------------------------------------------------------+"
            "\n|                                                                       |"
            "\n|        C++ Code / Program written Brit no0bsawcE! Jamerson!           |"
            "\t|        Software under-developement! :)                                | "
            "\n|        visit us at www.mo0seclan.xanimos.com                          |"
            "\t|                                                                       |"
            "\n+-----------------------------------------------------------------------+\n"
            "\n\n\t Select a choice that you would like to learn more information about:\n\n"
            "1: CS4$!\n" 
            "2: <Mo0se> Clan Community!\n" 
            "3: Credits!\n"
            "4: Program info!\n"
            "0: Exit!\n\n";

    cin >> choice;

    /*if( choice < 0 || choice > 3 ) // dont really need to check this because the default case will handle it
    {
        exit(0);
    }
    else
    {*/

    switch(choice)
    {
        case 1: ShowFirstOption();
        break;
        
        case 2: ShowSecondOption();
        break;
        
        case 3: ShowThirdOption();
        break;

        case 4: ShowFourthOption();
        break;
        
        default: exit(0);
        break;
    }
    return 0;
    }


void ShowFirstOption()
{
    cout << "YOU'VE SELECTED OPTION #1\n\n"
            "\t[---------------------------CS4$--------------------------------]\n"
            "\t  Counter-Strike4Cash is an online arena for cash and prizes.\n"
            "\t  Everyone will risk the same amount of\n" 
            "\t  cash PR(Per Round.)\n"
            "\t  When you take a portion of someones HP, you recieve an equal portion\n" 
            "\t  of cash from them.\n"
            "\t  You Can Check them out at www.counter-strike4cash.com!\n"
            "\t[---------------------------CS4$--------------------------------]\n\n\t\t";
        
            system("PAUSE");
}

void ShowSecondOption()
{
    cout << "YOU'VE SELECTED OPTION #2\n\n"
            "\t[---------------------------Mo0se--------------------------------]\n"
            "\t  <Mo0se> Clan was founded by myself an THEpro.\n"
            "\t  We are currently Recruiting only expierenced CSS Surf Players."
            "\t          Check out our site @ www.mo0seclan.xanimos.com !\n"
            "\t[---------------------------Mo0se--------------------------------]\n\n\n"
            "[---------------------------Members--------------------------------]\n\n"
            "  1. no0bsawcE! <Mo0se> - Brit Jamerson."
            "\n  2. THEpro <Mo0se> - Brad Duke."
            "\n  3. Chinese <Mo0se> - Dustin Lum.\n"
            "\b  4. TiM <Mo0se> - Tim.\n"
            "[---------------------------Members--------------------------------]\n\n\t"; 
    system("PAUSE");
}

void ShowThirdOption()
{
    cout << "YOU'VE SELECTED OPTION #3\n\n"
            "\t[---------------------------Credits--------------------------------]\t"
            "\t  1. no0bsawcE! <Mo0se> - Brit Jamerson(Me)\n"
            "\t  2. LittleDude @ Amxmodx forums for some assistance with code.\n"
            "\t[---------------------------Credits--------------------------------]\n\n\n\t\t\t";
    system("PAUSE");
} 

void ShowFourthOption() 
{
     cout << "YOU'VE SELECTED OPTION #4\n\n"
             "\t[---------------------------Program Info-----------------------------]\n"
             "\t  Version        = 1.0b.\n"
             "\t  Current State  = Beta.\n"
             "\t  Update1(1.0a)  = Removed all if elsestatements.\n"
             "\t  Update2(1.0b)  = Rebuilt the back-bone of the code.\n"
             "\t  Lead Developer = Brit no0bsawcE! Jamerson\n"
             "\t[---------------------------Program Info-----------------------------]\n\n\n\t\t";
     system("PAUSE");
}
__________________
i stop around here and there.
Da_sk8rboy is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:35.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode