aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Lab4/CST116F2021-Lab4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CST116F2021-Lab4/CST116F2021-Lab4.cpp')
-rw-r--r--CST116F2021-Lab4/CST116F2021-Lab4.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/CST116F2021-Lab4/CST116F2021-Lab4.cpp b/CST116F2021-Lab4/CST116F2021-Lab4.cpp
index aeb76a3..decdaa0 100644
--- a/CST116F2021-Lab4/CST116F2021-Lab4.cpp
+++ b/CST116F2021-Lab4/CST116F2021-Lab4.cpp
@@ -22,23 +22,25 @@ int main()
float average(int input1, int input2, int input3, float avg)
{
- cout << "Please input the first value: ";
- cin >> input1;
-
- while (input1 <= 0);
+ do
+ {
+ cout << "Please input the first value: ";
+ cin >> input1;
+ } while (input1 <= 0);
+
+ do
{
cout << "Please input the second value: ";
cin >> input2;
- }
+ } while (input2 <= 0);
- while (input2 <= 0);
+ do
{
cout << "Please input the third value: ";
cin >> input3;
- }
+ } while (input3 <= 0);
- while (input3 <= 0);
- avg = (input1 + input2 + input3)/3;
+ avg = (input1 + input2 + input3)/3;
return avg;
} \ No newline at end of file