really need help for my assignment. loops

I'm beginner and don't know what i must do, pls help me to make coding or the algorithm from this output. i used dev c++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Input the number of stones: 10
Input the stones have taken by player 1: 4
Many stone remaining: 6
 
Input the stones have taken by player 2: 6
The amount of rock must be between 1 and 4!
Input the stones have taken by player 2: 3
Many stone remaining: 3
 
Input the stones have taken by player 1: 4
Many stones were left less than a stone taken :(
Enter the number of stones from the player 1: 3
Many stone remaining: 0
 
Player 1 wins!


pls help me and thanks before
nb: I edit my post for my new question because I can't make new one
Last edited on
Almost there! You needed one more for loop for the spaces.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>

using namespace std;

int main()
{
	int i, j, n;

	cout << "input your number :"; cin >> n;

	for (i = 1; i <= n; i++) {
		for (j = i; j<n; j++) {
			cout << " ";
		}

		for (j = 1; j <= i; j++) {
			cout << "*";
		}
		cout << endl;
	}

	for (i = 1; i <= n; i++) {

		for (j = 1; j<=n; j++) {//added
			cout << " ";
		}
		for (j = i; j <= n; j++) {
			cout << "*";
		}
		cout << endl;
	}




	return 0;
}
get it! thank you so much sir
up please
Topic archived. No new replies allowed.