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


Expert's answer



#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;
}

LATEST TUTORIALS
APPROVED BY CLIENTS