-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiInput.cpp
More file actions
38 lines (30 loc) · 1.01 KB
/
Copy pathMultiInput.cpp
File metadata and controls
38 lines (30 loc) · 1.01 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
#include <iostream>
#include <string>
#include <limits>
int main() {
std::string name;
int age;
double height;
bool printer;
std::string degree;
std::cout << "What is your name? ";
std::getline(std::cin, name);
std::cout << "How old are you? ";
std::cin >> age;
std::cout << "What is your height in meters? ";
std::cin >> height;
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
std::cout << "What are you studying at University? ";
std::getline(std::cin, degree);
std::cout << "Do you own a 3D Printer? (Answer 1 for yes, 0 for no) ";
std::cin >> printer;
std::cout << "\nHello, " << name << "! You are " << age << " years old.\n";
std::cout << "Your height is " << height << " meters.\n";
std::cout << "\nYou are studying " << degree;
if (printer == 1) {
std::cout << "\nYou own a 3D printer";
} else {
std::cout << "\nYou don't own a 3D printer";
}
return 0;
}