C – jednoduché menu

Kamarádka potřebovala do školy naprogramovat jednoduché menu. Když už jsem se s tím dělal, dávám to k dispozici široké veřejnosti, třeba se to někomu bude někdy hodit :) .

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <stdio.h>
#include <stdlib.h>
 
int main(int argc, char *argv[])
{
  menu();
  system("PAUSE");	
  return 0;
}
 
int menu()
{
    system("cls"); 
 
    printf("%sn","Vyber:");
    printf("%sn","1. FUNKCE1");
    printf("%sn","2. FUNKCE2");
    printf("%sn","3. Konec");
 
 
    int i = 0;
    printf("%s ","Zadej číslo volby: ");
    scanf("%d",&i);
    while(i < 1 || i > 3)
    {
           printf("%s ","Zadej znovu číslo volby: ");
           scanf("%d",&i);
    }
 
    switch(i)
    {
     case 1: funkce1(); break;         
     case 2: funkce2(); break;
     case 3: 
          system("cls");
          printf("%sn","Sbohem"); 
          break;  
    }
}
 
int funkce1()
{
   system("cls");
   printf("%sn","Volas funkci 1:");  
   int i;
   printf("%s ","Napis 1 nebo 0 a zmackni enter: ");
   scanf("%d",&i); 
 
   menu();  
}
 
 
int funkce2()
{
   system("cls");
   printf("%sn","Volas funkci 2:");  
   int i;
   printf("%s ","Napis cislo a zmackni enter: ");
   scanf("%d",&i); 
 
   menu();  
}

Tagy:

8 Responses to “C – jednoduché menu”

  1. Chantelle napsal:

    hello…

    really good article. Ready to hear more next week,my blog http://www.zimbio.com/Wedding+Invitations/articles/4ErXz6GdreH/Adressing+Wedding+Invitations+Envelopes Many Thanks….

  2. Richelle napsal:

    hello…

    really good article. Ready to hear more next week,my blog http://eveningdressesvuv.sweetcircles.com/2010/12/20/low-priced-night-dresses/ Many Thanks….

  3. Eugenie napsal:

    really good article…

    I have spent a bit of time going through your posts, more than I should have but I must say, its worth it! http://rice071.zoomblog.com/ many Thanks….

  4. Jenzing napsal:

    hello…

    Hi there just quality post! http://sandraal.insanejournal.com/ ,i had a great read.thank you for your article,My problem has been resolved….

  5. Gander napsal:

    Great One…

    I must say, its worth it! My link!http://shannon071.insanejournal.com/692.html ,thanks haha…

  6. Cenzing napsal:

    Great…

    love your blog, http://tpm.clns.hu/index.php?site=forum_topic&topic=68 ,Thanks again….

  7. TadWinett napsal:

    really…

    Fat women and girls always worried because of their ugly shaped bodies. http://fcxmjkr.lovelogger.com/ , but they can not wear these outwears…

Leave a Reply