I stole my thread to ask something new.
I read somewhere else how to format the output text, say, add 20 spaces before the actual output comes.
Something like;
cout << [bleh:20] "Hello, world!";
Will come out with 20 spaces before Hello, world!
There was also a way to change the spacer so that you could say use - instead.
But i have lost this page.
Can anyone help me?
I dont need help with my old post, thanks.
Hello
I am trying to write a Loop, currently a while loop since i couldnt get a for loop to work.
I have previously told the used to enter a number in person.number, i now want the loop to call me a cin to place a name into and array, and do that the set number of times.
1 2 3 4 5 6
|
int n = 0;
while(n<=person.number){
cout << "Enter the name: ";
cin >> person.name[1++];
n++;
}
|
1. User enter number of persons.
2. The loop loops that set number of times.
3. The loop asks the user for a name each time.
4. That name is then put into an array.
5. The position in the array then moves up one position.
The problem here is with the array.
I keep getting:
\main.cpp(34) : error C2105: '++' needs l-value |
How do i tell it to increase the position in the array by one each time the loop runs, for a set number of times(by the user)?
Thank you.