-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path18.0 (C++) String, Input-Output.cpp
More file actions
47 lines (37 loc) · 1.08 KB
/
18.0 (C++) String, Input-Output.cpp
File metadata and controls
47 lines (37 loc) · 1.08 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
/// String: Input-Output
#include <iostream>
using namespace std;
int main()
{
char name [7];
name[0]='B';
name[1]='A';
name[2]='N';
name[3]='G';
name[4]='L';
name[5]='A';
name[6]='\0'; //null character using for avoid error from last index
cout<<" The string is: "<<name<<endl;
/* ----------- OR ----------- */
//here, array_size no needed
char name2 []={'B', 'A', 'N', 'G', 'L', 'A', '\0'};
cout<<" The string is: "<<name2<<endl;
/* ----------- OR ----------- */
//for Single line
char name3 []="BANGLA";
cout<<" The string is: "<<name3<<endl;
/* ----------- OR ----------- */
//for Multiple line and here, must be use '\' line breaking character.
char name4 []="BANGLA \ DESH";
cout<<" The string is: "<<name4<<endl;
return 0;
}
/* ===== Output/Result:
Input:___________________
(Initialization values within a program code)
Output:_________________
The string is: BANGLA
The string is: BANGLA
The string is: BANGLA
The string is: BANGLA DESH
*/