-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathString-manipulation-code.cpp
60 lines (56 loc) · 1.35 KB
/
String-manipulation-code.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
56
57
58
59
60
#include <iostream>
#include <iomanip>
using namespace std;
class flower
{
private:
string f1;
string f2;
public:
/**
* @brief Constructor for the flower class. Initializes the flower names and prints messages using manipulators.
*
* This constructor sets the names of two flowers (f1 and f2) to "Lily" and "Rose" respectively.
* It then prints out messages using the manipulators endl and setw to demonstrate their usage.
*
* @param None
*
* @return None
*
* @note The manipulators endl and setw are used to format the output.
*
* @code
* flower fl;
* @endcode
*
* @sa std::endl, std::setw
*/
flower()
{
f1 = "Lily";
f2 = "Rose";
cout << "Manipulator endl is used." << endl;
cout << "First flower is:" << f1 << endl;
cout << "Manipulator setw is used." << endl;
cout << "Second flower is:" << setw(13) << f2;
}
};
/**
* @brief The main function is the entry point of the program.
*
* This function initializes an instance of the flower class and returns 0 to indicate successful program execution.
*
* @return 0 - Indicates successful program execution.
*/
int main()
{
flower fl;
return 0;
}
/*
* Output:
* Manipulator endl is used.
* First flower is:Lily
* Manipulator setw is used.
* Second flower is: Rose
*/