-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcruise ctrl.txt
More file actions
94 lines (76 loc) · 1.77 KB
/
cruise ctrl.txt
File metadata and controls
94 lines (76 loc) · 1.77 KB
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
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
int ch,n,c=10,i;
char cr;
printf("Enter max speed : ",n);
scanf("%d",&n);
while(1)
{
printf("\n\t\tCHOICES\n\t\t~~~~~~~\n\t1.Accelerate\n\t2.Break\n\tc.To switch\t3.Exit\nEnter your choice : ");
scanf("%d",&ch);
switch(ch)
{
case 1:
while( c < n)
{
sleep(1000);
printf("Increasing the speed: %d\n", c);
c = c + 10;
scanf("%c", &cr);
if(cr == 'c')
{ printf("switching---------------\n");
break;
}
else
{
printf("\n");
}
}
if ( c >= n)
{
printf("Increasing the speed: %d\n", c);
printf("Already have reached the max speed%d\n", c);
break;
}
else
{
break;
}
case 2:
while(10 < c )
{
sleep(1000);
c = c - 10;
printf("Decreasing the speed: %d\n", c);
scanf("%c", &cr);
if(cr == 'c')
{
printf("switching---------------\n");
break;
}
else
{
printf("\n");
}
}
if ( c <= 10)
{
printf("Already have reached the min speed%d\n", c);
break;
}
else
{
break;
}
case 3:
exit(0);
default:
printf("\tIt is Wrong choice,Please enter correctchoice!............\n");
}
getch();
}
}