Answer the question
In order to leave comments, you need to log in
And how to make me enter 2 words and the first one counts how many letters and the second word displays in a column?
#include <iostream>
using namespace std;
int main() {
char s[50];
int d = 0;
cin >> s;
while (s[d]) cout << s[d++] << endl;
cout << "count: "<< d;
}
Answer the question
In order to leave comments, you need to log in
Here:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
cin >> str;
for (char& c : str) {
cout << c << endl;
}
cout << "count: "<< str.length() << endl;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question