0
How can I make program where you input a word where it outputs and repeats for as many times as it has letter in the word?
I only know the basic of the while function and of function so I have no idea how to. example : input = hello output = hello = hello = hello = hello
6 Antworten
+ 5
You want someone to code it for you or you just want the idea?
+ 5
int i=0;
while(i< word.length())
{
cout<<word;
i++;
}
+ 4
Use length() on the word string and loop using a for loop with the length as end condition.
+ 4
#include <string> in your program to use it.
0
just wanted some idea using only while and of funtion so dont know how to use length() yet.
0
here's idea
1 use string header
2 a is string variable which holds ur input
3 strlen(a) to get length of input string
4 use while(length > 0) and print string with length- -
5 done
6 like this answer