Need help please

if i entered 10 characters and i want the program to cout a certain character in the string and beside it all its orders in the string.
for example:
The result for orders of character 'a' in the string (banana);
a=2 ; // b=1, (a=2)
a=4 ; //b=1, a=2 , n=3 , (a=4)
a=6 ; //b=1, a=2 , n=3 , a=4 , n=5 ,(a=6)

or
a=2,4,6;

(i don't know which one is right to be written.)

Anyway what would be the code for the program ???
Last edited on
1
2
3
4
5
std::string name = "banana";
char first = name[0];
char second = name[1];
char third = name[2];
// And so on... 
what if i wanted to input a 5000 characters , should i write:
char first = name[0];
char second = name[1];
char third = name[2];
....................
// till let's say 3000????
this wouldn't be helpful !
EssGeEich (2118)@

the code didn't give me the desired result.
i don't want to put character by character , i want to put the character one time
and the program outputs the whole character orders in the string.
thanks for your help anyway :)
Last edited on
Topic archived. No new replies allowed.