Blame view

P27411_en/S003-AC.cc 449 Bytes
Imanol-Mikel Barba Sabariego authored
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
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int a,b;
	cin >> a;
	if(a < 1)
	{
		cout << "Incorrect position." << endl;
		return 0;
	}
	for(int i = 1; i < a; i++)
	{
		cin >> b;
		if(b == -1)
		{
			cout << "Incorrect position." << endl;
			return 0;
		}
	}
	cin >> b;
	if(b == -1)
	{
		cout << "Incorrect position." << endl;
		return 0;
	}
	cout << "At the position " << a << " there is a(n) " << b << "." << endl;

}