-
Notifications
You must be signed in to change notification settings - Fork 1
/
ex06.cpp
37 lines (29 loc) · 898 Bytes
/
ex06.cpp
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
#include <iostream>
#include <string>
struct CandyBar
{
std::string name;
float weight;
int calories;
};
int main()
{
CandyBar snack[3] =
{
{"Mocha Much", 2.3, 350},
{"Super Snack", 3.5, 420},
{"Chocosnack", 3.1, 230}
};
std::cout << "name: " << snack[0].name << std::endl;
std::cout << "weight: " << snack[0].weight << std::endl;
std::cout << "calories: " << snack[0].calories << std::endl;
std::cout << std::endl;
std::cout << "name: " << snack[1].name << std::endl;
std::cout << "weight: " << snack[1].weight << std::endl;
std::cout << "calories: " << snack[1].calories << std::endl;
std::cout << std::endl;
std::cout << "name: " << snack[2].name << std::endl;
std::cout << "weight: " << snack[2].weight << std::endl;
std::cout << "calories: " << snack[2].calories << std::endl;
return 0;
}