-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9_2.cpp
More file actions
33 lines (27 loc) · 684 Bytes
/
9_2.cpp
File metadata and controls
33 lines (27 loc) · 684 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
26
27
28
29
30
31
32
33
// By luckycallor
// Welcome to my site: www.luckycallor.com
#include<iostream>
using namespace std;
void strcount(const string& str)
{
static int total = 0;
total += str.length();
cout << "\"" << str << "\"" << "contains " << str.length() << " characters" << endl;
cout << total << "charactors total" << endl;
}
int main()
{
string str;
//char next;
cout << "Enter a line:\n";
getline(cin,str);
while(str != ""){
//cin.get(next);
//while(next != '\n') cin.get(next);
strcount(str);
cout << "Enter next line (empty line to quit):\n";
getline(cin,str);
}
cout << "Bye!" << endl;
return 0;
}