-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA3Q2.cpp
More file actions
71 lines (61 loc) · 1.19 KB
/
A3Q2.cpp
File metadata and controls
71 lines (61 loc) · 1.19 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
/*
Project: Assignment 3
Class: CPSC 240
Professor: Dr. Ray Ahmadnia
Authors: Cuevas, Fernando
Huang, Justin
Due: 9/14/2017
*/
#include <iostream>
#include <string>
using namespace std;
int averageScore, scores, scoreCount,totalscore;
int stopLoop = -1;
void getScore()
{
averageScore = totalscore / scoreCount;
}
void askScore()
{
cout << "Enter your score (-1) to stop: ";
cin >> scores;
}
void displayScore()
{
cout << "Your average is " << averageScore <<endl;
}
void displaywords()
{
cout << "Lets compute your score's average: " << endl;
}
int main()
{
_asm
{
call displaywords
dowhile:
call askScore
mov eax,scores
cmp scores,-1
Je done
add totalscore,eax
inc scoreCount
Jmp doWhile
done:
mov scores,eax
call getScore
call displayScore
}
}
/*
-------------------OUTPUT--------------------
Lets compute your score's average:
Enter your score (-1) to stop: 70
Enter your score (-1) to stop: 88
Enter your score (-1) to stop: 90
Enter your score (-1) to stop: 77
Enter your score (-1) to stop: -1
Your average is 81
Press any key to continue . . .
--------------------------------------------
*/