-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathppo.cpp
More file actions
57 lines (45 loc) · 1020 Bytes
/
Copy pathppo.cpp
File metadata and controls
57 lines (45 loc) · 1020 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
55
56
57
#include <iostream>
#include <string>
#include <conio.h>
#include <unistd.h>
#include <iomanip>
#include <stdio.h>
using namespace std;
class Produto{
private:
string cor_embalagem, marca;
float preco;
public:
void setcor(){
cout << "Digite a cor" << endl;
getline(cin, cor_embalagem);
fflush(stdin);
}
void setmarca(){
cout << "Digite a marca" << endl;
getline(cin, marca);
fflush(stdin);
}
void getpreco(){
cout << "Digite o preco" << endl;
scanf("%f", &preco);
fflush(stdin);
}
void print(){
cout << fixed << setprecision(2) << "A cor da embalagem eh: " << cor_embalagem << endl << "A marca do produto eh: " << marca << endl << "O preco do produto eh: " << preco << endl;
}
};
int main() {
Produto produtos[2];
for(int i = 0; i < 2; i++){
fflush(stdin);
produtos[i].setmarca();
produtos[i].setcor();
produtos[i].getpreco();
system("cls");
}
for(int i = 0; i < 2; i++){
produtos[i].print();
}
return 0;
}