+ 1
Program to calculate the number of steps
10 Réponses
+ 1
#include <iostream>
using namespace std;
int main() {
string str = "This is test ";
int nos_of_spaces = 0;
for(int i=0;i<str.length();i++){
if(str[i] == ' '){
nos_of_spaces++;
}
}
cout<<str<<" contains "<<nos_of_spaces<<" spaces"<<endl;
return 0;
}
0
Number of steps of what??
0
example...if we wrote something
The no of steps are 3
0
please tell
0
your question is unclear it would be nice if you could explain with some example
0
I am tasking that how to make a program which can tell that how many steps are in a given string for example Abhishek Kumar it has only one space so how to make this program which can tell the number of steps
0
asking
0
hope it helped :)
0
thanks
0
if it worked for you plz VOTE UP the answer