enter radius

Write your question here.
hello people
I have problem with the menu when I enter anything it goes to circle area radius problem
have a look at the code
please

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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<iostream>


int main(void)
{
int menu,mid,fin,r,choice;
float last, area,gr;
    char userId[10],passwrd[10];
    char uoid[] = "MIS",opasswrd[] = "123";
    int chances = 3;


    while (chances)
    {
        printf("Enter User ID -> ");
        scanf("%s", userId);
        printf("\n");
        printf("Enter Your Password -> ");
        scanf("%s", passwrd);

        if (strcmp(uoid, userId) == 0 && strcmp(passwrd, opasswrd) == 0)
        {
            printf("Correct User Id And Password\n");
            break;
        }
        else
        {
            printf("Invalid User Id And Password\n\n");
            chances--;

            if(!chances)
            {
                printf("You have no more chances...\n");
                printf("Do you want to register y/n -> ");

                printf("\n");


                {
                    printf("Enter your new ID -> ");
                    scanf("%s",uoid);
                    printf("Enter your new PW -> ");
                    scanf("%s",opasswrd);

                    chances = 3;
                }
            }
        }
    }

    clrscr();








    clrscr();
    printf("=====PROGRAM MENU=====");
    printf("\n\n[1] = CIRCLE AREA");
    printf("\n[2] = RECTANGLE AREA");
    printf("\n[3] = TRIANGLE AREA");
    printf("\n[4] = LAST GRADE");
    printf("\n[5] = LETTER GRADE");
    printf("\n[6] = FACTORIAL");
    printf("\n[7] = PRINTING");
   printf("\n[8] = Exit Program");
    printf("\n\nChoice : ");
    printf("\n\(1)=PROGRAM MENU=");
    printf("\n\--------------------");
    printf("\n[1] - CIRCLE AREA");
   printf("\n-------------------");
  printf("\nEnter Radius of Circle");
  scanf("%d",&r);
  area=3.14*r*r;
  printf("\nArea is : %f",area);
  {
  clrscr();
  printf("BYE!!!!!!!!!!");
   }
   {
   printf("WRONG INPUT TRY AGAIN!!!!!!!");
   }

    printf("\n[2] = RECTANGLE AREA");
    printf("\n--------------------");
    printf("\n[3] = TRIANGLE AREA");
    printf("\n--------------------");
    printf("\n[4] = LAST GRADE");
     printf("\n-------------------");
  printf("\nEnter Midterm Grade");
  scanf("%d",&mid);
  printf("Enter Final Grade");
  scanf("%d",&fin);
  last=0.4*mid+0.6*fin;
  printf("\nLast Grade is : %f",last);
  clrscr();
    printf("\n[5] = LETTER GRADE");
    printf("\n-------------------");
  printf("\nEnter Grade : ");
  scanf("%f",&gr);
    if(gr>=90)
    printf("Letter Grade is : A");
    else if(gr>=80)
    printf("Letter Grade is : B");
     else if(gr>=70)
    printf("Letter Grade is : C");
     else if(gr>=60)
    printf("Letter Grade is : D");
     else
    printf("Letter Grade is : F");
    printf("\n[6] = FACTORIAL");
    printf("\n--------------------");
    printf("\n[7] = PRINTING");
    printf("\n--------------------");
   printf("\n[8] = Exit Program");
   printf("\n--------------------");
    printf("\n\USER CHOICE : ");
    scanf("%d",&choice);
    switch (choice)
    {
    case 1:
        clrscr();
        FILE * f;

        f=fopen("test.txt","r+");
        if(f==NULL){
            printf("No Database");
}
}
    getch();
}
Well yeah. Lines 65-72 you display your menu, but you never input the user's choice. You simply fall through to line 76. Where do you think you're accepting the user's choice?

Topic archived. No new replies allowed.