help me make a code please...
i need a code when you pick one of the menu then the menu you
pick will show up... then when you press anything it will go back to menu again....
can someone show me the code please???....


Thanks......

I think you should give more details about your problem. Have you started to write your code even just the main function? What menu?

show menu
    
     if i pick one menu
          Choose me
     else if i press anything
          show menu

sorry i need to erase this code....

Member Avatar for iamthwee
#include <iostream.h>

int main()
{
  int x;
  int y;
  int z;
  char cs, E; 
  do
  {
    cout << "MENU\n";
    cout << "(A) Triangle1\n";
    cout << "(B) Triangle2\n";
    cout << "(C) Triangle3\n";
    cout << "(D) Triangle4\n";
    cout << "(Q) Quit\n";
    cout << "Enter Choice";
    cin >> cs;
    switch ( cs )
    {
    case 'A':
      for ( x = 0; x < 5; ++x )
      {
        for ( y = 0; y < 5; ++y )
        {
          if ( x <= y )
          {
            cout << " *";
            system ( "color 1A" );
          }
          else
          {
            cout << " ";
          }
        }
        cout << "\n\n";
      }
      break;
    case 'B':
      for ( x = 5; x >= 1; x-- )
      {
        for ( y = 1; y <= x; y++ )
        {
          cout << " * ";
          system ( "color 2B" );
        }
        cout << "\n\n";
      }
      break;
    case 'C':
      for ( x = 5; x > 0; x-- )
      {
        for ( y = 0; y <= 6; y++ )
        {
          if ( x >= y )
          {
            cout << " ";
          }
          else
          {
            cout << " * ";
            system ( "color 0C" );
          }
        }
        cout << "\n\n";
      }
      break;
    case 'D':
      for ( x = 0; x < 6; x++ )
      {
        for ( y = 6; y > x; y-- )
        {
          cout << " ";
        }
        for ( z = 0; z < y; z++ )
        {
          cout << " * ";
          system ( "color 4B" );
        }
        cout << "\n\n\n";
      }
      break;
    }
    getchar();
  }
  while ( cs != 'Q' );
  return 0;
}

I'd probably use a do-while loop.

Just to make it clearer....

1. Add another statement at the end of your coding. Prompt User to enter a certain character to exit from the program.

2. iamthwee is right. Use a do-while loop to do that. Last hint, the while statement you can write something like this:

while (choice != 'e')

I think it closes because of the break; after the loops.

I've edited a bit in your code.

#include <iostream>
#include <stdio.h>

using namespace std;


int main()
{
	int x;
	int y;
	int z;
	char cs;

	cout<<"MENU\n";
	cout<<"(A) Triangle1\n";
	cout<<"(B) Triangle2\n";
	cout<<"(C) Triangle3\n";
	cout<<"(D) Triangle4\n";
	cout<<"Enter Choice: " << endl;
	cin>>cs;

	switch (cs){
		case 'A': case 'a':
			for(x = 0; x < 5; ++x)
			{
				for(y = 0; y < 5; ++y)
				{
					if(x <= y)
					{
						cout<<" *";
						system("color 1A");
					}else
					{
						cout<<" ";
					}
				}
				cout<<"\n\n";
			}
		
	
		case 'B': case 'b':
			for(x=5;x>=1;x--)
			{
				for(y=1;y<=x;y++)
				{
					cout<<" * ";
					system("color 2B");
				}
					cout<<"\n\n";
			}
		
		case 'C': case 'c':
			for(x=5;x>0;x--)
			{
				for(y=0;y<=6;y++)
				{
					if(x>=y)
					{
						cout<<" ";
					}else
					{
						cout<<" * ";
						system("color 0C");
					}
				}
					cout<<"\n\n";
			}
	
		case 'D': case 'd':
	
			for(x=0;x<6;x++)
			{
				for(y=6;y>x;y--)
				{
					cout<<" ";
				}
				
				for(z=0;z<y;z++)
				{
					cout<<" * ";
					system("color 4B");
				}
				
				cout<<"\n\n\n";
			}

		default: 
			cout << "Wrong input!" << endl;
	}
	getchar();
	return 0;
}

iamthwee's much more reliable, with the exit and the d-while loop :)

thanks to all who reply at my question....


can you delete your reply for some reason please??....

i dont want someone see my code please.......

I think that would be impossible. :) And I think the mods can't do it too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.