Answer to Question #297545 in C++ for lekha

Question #297545

Given a string on one line, output the length of that string. End with a newline.

Ex: If the input is:

Fuzzy bear

the output is: 10


1
Expert's answer
2022-02-14T12:04:32-0500


#include <iostream>
using namespace std;


int main() {
	char inputString[1000];
	int length=0;
	cout<<"Enter a String: ";
	gets(inputString);


	for(int j=0;inputString[j]!='\0';j++){
		length++;
	}


	cout <<"Length: "<< length<< endl;


	system("pause");
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog