-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
whilebool.cpp
88 lines (83 loc) · 1.82 KB
/
whilebool.cpp
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
#include <iostream>
#include <string>
#include <windows.h>
#include <conio.h>
using namespace std;
void gotoyx(int x, int y)
{
COORD c = { x, y};
SetConsoleCursorPosition( GetStdHandle(STD_OUTPUT_HANDLE), c);
}
int main()
{
string namayogi;
int nimyo;
double nilaiyog;
char anugrade;
system("Color 0A");
cout <<"++++++++++++++++++++++++++++++" <<endl;
cout <<" Progam Data Mahasiswa " <<endl;
cout <<"++++++++++++++++++++++++++++++" <<endl;
cout <<"Masukan Nama : " ;
getline(cin,namayogi);
cout <<"Masukan Nim : " ;
cin >>nimyo;
cout <<"Masukan Nilai : " ;
cin >>nilaiyog;
if (nilaiyog >= 85 && nilaiyog <=100)
{
anugrade = 'A';
}
else if (nilaiyog >= 70 && nilaiyog <85 )
{
anugrade = 'B';
}
else if (nilaiyog > 55 && nilaiyog <70 )
{
anugrade = 'C';
}
else if (nilaiyog >= 40 && nilaiyog <55 )
{
anugrade = 'D';
}
else{
anugrade ='E';
}
cout <<"++++++DATA MAHASISWA+++++++" << endl;
cout <<"Nama : " <<namayogi <<endl;
cout <<"Nim : " <<nimyo <<endl;
cout <<"Nilai : " <<nilaiyog <<endl;
cout <<"Nilai Index : " <<anugrade <<endl;
//looping with bool .
bool deloop = true;
char traegen;
while (deloop == true)
{
cout <<"input 'y' untuk input data lagi , dan 'n' untuk exit" <<endl;
cin >>traegen;
if ( traegen == 'y')
{
main();
deloop = true;
}
else if (traegen == 'n')
{
deloop = false;
gotoyx(45,24);
//dont change above text for us <code><precode>codepen
//https://github.com/yogithesymbian/c-/blob/master/whilebool.cpp
cout <<" Thanks for using My Program | GNU/GPL (C) 2017 " <<endl;
gotoyx(80,9);
cout <<" ------------------ " <<endl;
gotoyx(80,10);
cout <<"| IGN : Newbie C++ |" <<endl;
gotoyx(80,11);
cout <<"| NIM : 17615006 |" <<endl;
gotoyx(80,12);
cout <<"| -----------------| " <<endl;
cout <<endl; cout <<endl;
system("PAUSE");
}
return EXIT_SUCCESS;
}
}