Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CH9_EX1.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include <iostream>
- #include <string>
- #include <iomanip>
- using namespace std;
- struct computer
- {
- string manufacturer;
- string modelType;
- string processorType;
- int ram;
- int hardDriveSize;
- int yearBuilt;
- float price;
- };
- int main()
- {
- computer myComputer;
- cout << fixed << showpoint << setprecision(2);
- cout << "Enter the name of the manufacturer: ";
- getline(cin, myComputer.manufacturer);
- cout << endl;
- cout << "Enter the model of the computer: ";
- getline(cin, myComputer.modelType);
- cout << endl;
- cout << "Enter processor type: ";
- getline(cin, myComputer.processorType);
- cout << endl;
- cout << "Enter the size of RAM (in GB): ";
- cin >> myComputer.ram;
- cout << endl;
- cout << "Enter the size of hard drive (in GB): ";
- cin >> myComputer.hardDriveSize;
- cout << endl;
- cout << "Enter the year the computer was built: ";
- cin >> myComputer.yearBuilt;
- cout << endl;
- cout << "Enter the price: ";
- cin >> myComputer.price;
- cout << endl;
- cout << "Manufacturer: " << myComputer.manufacturer << endl;
- cout << "Model: " << myComputer.modelType << endl;
- cout << "Processor: " << myComputer.processorType << endl;
- cout << "Ram: " << myComputer.ram << endl;
- cout << "Hard Drive Size: " << myComputer.hardDriveSize << endl;
- cout << "Year Built: " << myComputer.yearBuilt << endl;
- cout << "Price: $" << myComputer.price << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement