-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic-io.cpp
More file actions
47 lines (40 loc) · 1.07 KB
/
basic-io.cpp
File metadata and controls
47 lines (40 loc) · 1.07 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
//
// Created by zing on 3/24/2020.
//
#include <iostream>
using namespace std;
void output(int x) {
cout << "Output sentence" << endl; // prints Output sentence on screen
cout << 120 << endl; // prints number 120 on screen
cout << x << endl;
cout << "This " << " is a " << "single C++ statement" << endl;
}
void input() {
int i;
cout << "Please enter an integer value: ";
cin >> i;
cout << "The value you entered is " << i;
cout << " and its double is " << i * 2 << ".\n";
}
void input_strings() {
string str;
cout << "What's your name? ";
getline(cin, str);
cout << "Hello " << str << ".\n";
cout << "What is your favorite team? ";
getline(cin, str);
cout << "I like " << str << " too!\n";
}
/*
void string_stream() {
string str;
float price = 0;
int quantity = 0;
cout << "Enter price: ";
getline(cin, str);
stringstream(str) >> price;
cout << "Enter quantity: ";
getline(cin, str);
stringstream(str) >> quantity;
cout << "Total price: " << price * quantity << endl;
}*/