-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrtype4.cpp
More file actions
25 lines (20 loc) · 823 Bytes
/
strtype4.cpp
File metadata and controls
25 lines (20 loc) · 823 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
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main(int argc, char *argv[])
{
char charr[20];
string str;
std::cout << "Length of string in charr before input: " << strlen(charr) << std::endl;
std::cout << "Length of string in str before input:" << str.size() << std::endl;
std::cout << "Enter a line of text:" << std::endl;
cin.getline(charr, 20);
std::cout << "You entered: " << charr << std::endl;
std::cout << "Enter anther line of text:" << std::endl;
getline(cin, str);
std::cout << "You entered: " << str << std::endl;
std::cout << "Length of string in charr after input: " << strlen(charr) << std::endl;
std::cout << "Length of string in str after input: " << str.size() << std::endl;
return 0;
}