forked from Mooophy/Cpp-Primer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex7_41_TEST.cpp
55 lines (48 loc) · 1.26 KB
/
ex7_41_TEST.cpp
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
//
// ex7_41_TEST.cpp
// Test of Exercise 7.41
//
// Created by pezy on 11/14/14.
// Copyright (c) 2014 pezy. All rights reserved.
//
#include "ex7_41.h"
using std::cout; using std::endl;
int main()
{
cout << "1. default way: " << endl;
cout << "----------------" << endl;
Sales_data s1;
cout << "\n2. use std::string as parameter: " << endl;
cout << "----------------" << endl;
Sales_data s2("CPP-Primer-5th");
cout << "\n3. complete parameters: " << endl;
cout << "----------------" << endl;
Sales_data s3("CPP-Primer-5th", 3, 25.8);
cout << "\n4. use istream as parameter: " << endl;
cout << "----------------" << endl;
Sales_data s4(std::cin);
return 0;
}
// print
/*
* 1. default way:
* ----------------
* Sales_data(const std::string&, unsigned, double)
* Sales_data()
*
* 2. use std::string as parameter:
* ----------------
* Sales_data(const std::string&, unsigned, double)
* Sales_data(const std::string&)
*
* 3. complete parameters:
* ----------------
* Sales_data(const std::string&, unsigned, double)
*
* 4. use istream as parameter:
* ----------------
* Sales_data(const std::string&, unsigned, double)
* Sales_data()
* Sales_data(istream &is)
*
*/