blob: de2eaba44ca76f7eb41841d3a4ce19044b5b549d (
plain) (
blame)
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
// Lab3-Ansari.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
using namespace std;
int main()
{
int numAssignments;
int avgNum = 0;
int Assignment;
cout << "Please enter the number of assignments in the class: ";
cin >> numAssignments;
if (numAssignments > 0) {
for (int i = 0; i < numAssignments; i++) {
cout << "Please enter assignment score: ";
cin >> Assignment;
avgNum += Assignment;
}
cout << endl;
cout << "The average of the assignments is: ";
cout << (float)avgNum / numAssignments;
}
else {
cout << "Insufficient number of assignments";
}
}
//int a = 0;
//cout << a++ << endl;
//cout << ++a << endl;
//cout << a + 1 << endl;
//cout << a << endl;
//cout << --a << endl;
/*
int money;
cout << "Please enter how much money is in your account: ";
cin >> money;
cout << endl;
int accnt_num;
cout << "Please enter how many types of accounts you own: ";
cin >> accnt_num;
cout << endl;
string level;
if (money >= 25000) {
level = "Platinum";
}
else if (money >= 10000 && accnt_num == 2) {
level = "Gold";
}
else if (money >= 10000 && accnt_num == 1) {
level = "Silver";
}
else {
level = "Copper";
}
cout << level;
short guess;
cout << "ENter a number between 0 and 4: ";
cin >> guess;
switch (guess)
{
case 0:
cout << "Zero" << endl;
break;
case 1:
cout << "One" << endl;
break;
case 2:
cout << "Two" << endl;
break;
case 3:
cout << "Three" << endl;
break;
case 4:
cout << "Four" << endl;
break;
default:
cout << "Invalid guess entered.";
}
float loanAmount;
float interestRate;
float amountDue;
cout << "Enter requested loan amount: ";
cin >> loanAmount;
cout << endl;
cout << "Enter interest rate: ";
cin >> interestRate;
cout << endl;
amountDue = loanAmount * (interestRate / 100);
if ((loanAmount >= 100 && loanAmount <= 1000) && (interestRate >= 1 && interestRate <= 18)) {
if (loanAmount <= 500) {
amountDue += 20;
cout << "Loan requested: " << loanAmount << ", Interest rate: " << interestRate << endl;
cout << "Total Amount over loan due: " << amountDue;
}
else {
amountDue += 25;
cout << "Loan requested: " << loanAmount << ", Interest rate: " << interestRate << endl;
cout << "Total Amount over loan due: " << amountDue;
}
}
else {
cout << "INVALID";
}
*/
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
|