FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpp-programming/OOP1-Lab9/Source2.cpp at main · TMB-Enterprises/cpp-programming · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
TMB-Enterprises
/
cpp-programming
Public
forked from
Rustam-Z/cpp-programming
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpp-programming
/
OOP1-Lab9
/
Source2.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
78 lines (73 loc) · 1.95 KB
Breadcrumbs
cpp-programming
/
OOP1-Lab9
/
Source2.cpp
Copy path
File metadata and controls
78 lines (73 loc) · 1.95 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
include
<
iostream
>
#
include
<
string
>
using
namespace
std
;
void
main_menu_view1
()
{
cout <<
"
\t\t\t\t
SALESMAN & PRODUCTS
\n
"
;
cout <<
"
===================================================================================
\n
"
;
cout <<
"
= || Salesman 1 || Salesman 2 || Salesman 3 || Salesman 4 || Salesman 5 =
\n
"
;
cout <<
"
===================================================================================
\n
"
;
cout <<
"
= Product 1 || || || || || =
\n
"
;
cout <<
"
= Product 2 || || || || || =
\n
"
;
cout <<
"
= Product 3 || || || || || =
\n
"
;
cout <<
"
===================================================================================
\n
"
;
}
void
salesman_sum
(
int
a[
3
][
5
])
{
int
row, col, sum =
0
;
//
finding the column sum
for
(row =
0
; row <
5
; ++row)
{
for
(col =
0
; col <
3
; ++col)
{
//
Add the element
sum = sum + a[col][row];
}
//
Print the column sum
cout <<
"
The Total sales of Salesman
"
<< row +
1
<<
"
is
"
<< sum << endl;
//
Reset the sum
sum =
0
;
}
}
void
sales_sum
(
int
a[
3
][
5
])
{
int
sum =
0
;
for
(
int
row =
0
; row <
3
; row++)
{
for
(
int
col =
0
; col <
5
; col++)
{
sum += a[row][col];
//
adding all arrays
}
cout <<
"
The Total sales of Product
"
<< row +
1
<<
"
is
"
<< sum << endl;
sum =
0
;
//
reset the sum
}
}
int
main
()
{
main_menu_view1
();
int
a[
3
][
5
];
//
inputting numbers for the 2D array
cout <<
"
Please input 5 Sales for Salesman 1, Salesman 2 and Salesman 3:
\n
"
;
for
(
int
row =
0
; row <
3
; row++)
{
for
(
int
col =
0
; col <
5
; col++)
{
cin >> a[row][col];
}
}
cout <<
"
Main table of Salesman and Sales:
\n
"
;
for
(
int
row =
0
; row <
3
; row++)
{
for
(
int
col =
0
; col <
5
; col++)
{
cout << a[row][col] <<
"
"
;
}
cout << endl;
}
cout << endl;
salesman_sum
(a);
cout << endl;
sales_sum
(a);
system
(
"
pause
"
);
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL