-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpro20.cpp
46 lines (36 loc) · 886 Bytes
/
pro20.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
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main(){
char name[4] = "abc";
//null character automatically appended
//space not accepted
cout<<name<<endl;
char name2[] = {'a', 'b', 'c', ' ', 'd'};
cout<<name2<<endl;
char name1[] = "hello world";
//space accepted
//null character automatically appended
cout<<name1<<endl;
char name3[20];
//space accepted
//null character automatically appended
gets(name3);
puts(name3);
char name4[10];
//space accepted
//null character automatically appended
cin.get(name4, 5);
cout<<name4<<endl;
char name5[100];
cin.getline(name5, 100, 'a');
cout<<name5<<endl;
cout<<strcmp(name1, name5)<<endl;
strcat(name1, name5);
cout<<name1<<endl<<name5<<endl;
cout<<strlen(name1)<<endl<<strlen(name5)<<endl;
strcpy(name1, name5);
cout<<name1<<endl<<name5<<endl;
return 0;
}