-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo.ComputerStucture.cpp
More file actions
81 lines (61 loc) · 2.09 KB
/
Copy pathDemo.ComputerStucture.cpp
File metadata and controls
81 lines (61 loc) · 2.09 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
72
73
74
75
76
77
78
79
80
81
//**********************************************************************************
// Author: Jonathan Gonzalez
// Date: 22 Apr 2025
// Language: C++
// Assignment: Demo
// Description: Manage the details of a computer
//**********************************************************************************
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
// define structures
struct ComputerType
{
string manufacturer;
string modelType;
string processorType;
int ram;
int hardDriveSize;
int yearBuilt;
double price;
};
// function prototypes
void printComputerInfo( ComputerType );
int main()
{
// declare local variables
ComputerType computer;
// set the output formatting for currency
cout << fixed << showpoint << setprecision(2);
// get the data from the user and assign to the properties
cout << "Enter the name of the manufacturer: ";
getline(cin, computer.manufacturer);
cout << "Enter the model type of the computer: ";
getline(cin, computer.modelType);
cout << "Enter the processor type: ";
getline(cin, computer.processorType);
cout << "Enter the size of the RAM (in GB): ";
cin >> computer.ram;
cout << "Enter the size of the hard drive (in GB): ";
cin >> computer.hardDriveSize;
cout << "Enter the year the computer was built: ";
cin >> computer.yearBuilt;
cout << "Enter the price: $";
cin >> computer.price;
cout << endl;
return 0;
}
// function definitions
// function that accepts a ComputerType, and dsiplays the value
void printComputerInfo(ComputerType pComputer)
{
// display the computer details
cout << "Manufacturer: " << pComputer.manufacturer << endl
<< "Model: " << pComputer.modelType << endl
<< "Processor: " << pComputer.processorType << endl
<< "RAM: " << pComputer.ram << endl
<< "Hard Drive Size: " << pComputer.hardDriveSize << "GB\n"
<< "Year Built: " << pComputer.yearBuilt << endl
<< "Prices: $" << pComputer.price << endl << endl;
}