-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreate-then-use-structure.cpp
More file actions
54 lines (33 loc) · 978 Bytes
/
Create-then-use-structure.cpp
File metadata and controls
54 lines (33 loc) · 978 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//CSC 160 Homework 1 Due 4/29/16
//Purpose: Write program using structure of fruit
//Author: Larsen J Close Most recent changes: 4/29/16
#include <iostream> // preprocessor directive
#include <iomanip> // needed for most manipulators
using namespace std; // using directive
struct fruit
{
char type[20];
double p;
};
int main ( void )
{
fruit c1, c2, c3;
cout << "To create a fruit inventory: \n";
for( int i =0; i<3; i++)
{
cout << "Enter fruit type: ";
cin >> c1.type;
cout >> "\nEnter fruit price per pound: ";
cin >> c2.p;
}
cout << "Fruit inventory data is as follows: \n";
cout << "Fruit Price\n";
for( int i =0; i<3; i++)
{
cout << fruit;
}
system("pause");
return 0;
} //end main ( )
/* Display of above program
*/