-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrobj.cpp
More file actions
35 lines (30 loc) · 802 Bytes
/
arrobj.cpp
File metadata and controls
35 lines (30 loc) · 802 Bytes
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
#include <iostream>
#include <string>
#include <array>
const int Seasons = 4;
const std::array<std::string, Seasons> Snames = {"Spring", "Summer", "Fall", "Winter"};
void fill(std::array<double, Seasons> *expense);
void show(std::array<double, Seasons> expense);
int main(int argc, char const *argv[])
{
std::array<double, Seasons> expense;
fill(&expense);
show(expense);
return 0;
}
void fill(std::array<double, Seasons> *expense)
{
for (int i = 0; i < Seasons; i++)
{
std::cout << "Enter " << Snames[i] << " expeses: ";
std::cin >> (*expense)[i];
}
}
void show(std::array<double, Seasons> expense)
{
std::cout << "EXPENSES\n";
for (int i = 0; i < Seasons; i++)
{
std::cout << Snames[i] << " : $" << expense[i] << std::endl;
}
}