loops - C++ looping back to a main menu -


i've started learn c++, i'm trying build program run several programs inside itself, of can accessed main menu, i've managed make multiplication chart come first program user can choose, can't figure out how program clear screen , bring main menu up, issue i've tried far: getchar(), return 0;, system("pause") halt loop have after 1 line has been printed, , in cases have hit enter every single line. there way entire chart print , have sit on screen until user closes specific key, key clearing screen , bringing main menu up? in advance, i've done searching i'm rather confused @ moment.

here's i've written far, menu , charts loop...

printf("\n******************************************************"); printf("\n******************************************************"); printf("\n**         hello , welcome program!         **"); printf("\n** please select program run! **"); printf("\n******************************************************"); printf("\n**                 - 1. multiplication table        **"); printf("\n**                 - 2. program b  -                **"); printf("\n**                 - 3. program c  -                **"); printf("\n**                 - 4. program d  -                **"); printf("\n******************************************************"); printf("\n******************************************************"); printf("\n "); scanf("%d", &selection); system("cls");  switch (selection) {      case 1:           int i, j;              printf ("   |");             (i = 1; <= 10; ++i)                 printf ("%#3d   ", i);             printf ("\n");              (i = 1; < 64; ++i)                 printf ("-");             printf ("\n");              (i = 1; <= 10; ++i) {                 printf ("%#2d |", i);                 (j = 1; j <= 10; ++j)                     printf ("%#3d   ", * j);                 printf ("\n");         }          break; 

many questions here , no c++. answering in c.

clearing screen beaten death elsewhere.

as looping, put code above while loop , add fifth selection: exit.

bool done = false; while(!done) {     printf("\n******************************************************");     printf("\n******************************************************");     printf("\n**         hello , welcome program!         **");     printf("\n** please select program run! **");     printf("\n******************************************************");     printf("\n**                 - 1. multiplication table        **");     printf("\n**                 - 2. program b  -                **");     printf("\n**                 - 3. program c  -                **");     printf("\n**                 - 4. program d  -                **");     printf("\n**                 - 5. exit       -                **");     printf("\n******************************************************");     printf("\n******************************************************");     printf("\n ");     scanf("%d", &selection);     system("cls");      switch (selection)      {       case 1:           {                 int i, j;                    printf ("   |");                     (i = 1; <= 10; ++i)                       printf ("%#3d   ", i);                       printf ("\n");                        (i = 1; < 64; ++i)                       printf ("-");                       printf ("\n");                      (i = 1; <= 10; ++i){                         printf ("%#2d |", i);                         (j = 1; j <= 10; ++j)                         printf ("%#3d   ", * j);                         printf ("\n");                 }                 break;      case 5:          done = true;          break;  } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -