how do I determine a position of an inputted number?

okay... This problem was solved before by Turbine.. but later this morning my professor just changed my programs output...
Here's my Program by the way...
>>Using C++ Program, input series of five (5) numbers. Determine the position of the five inputted numbers.
Example Output:
Data Entry:1
Data Entry:3
Data Entry:5
Data Entry:7
Data Entry:9

?_ <-in the blank is where the user should enter any of his/her inputted numbers.
if I enter for example 5, this should be what its output should be.
?5 is in the third position

another example:
Data Entry:1
Data Entry:2
Data Entry:3
Data Entry:1
Data Entry:2

?_ <- if I enter the number 2 for example...
?2 is in the second and fifth position

THERE...
and so far, here is what I have come up with... Can anyone please tell me what I did wrong with the code? Because it only prints "is in the first position"

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
38
#include<conio.h>
main()
{
int array_mo[5],i,x;
for (i=0;i<5;i++)
	{
		printf("data entry:");
		scanf("%d",&array_mo[i]);
	}
	printf("\n?");
		for(x=1;x!=2;x++)
		{
			scanf("%d",&array_mo[x]);
		}
			if (array_mo[x]=array_mo[1])
			{
				printf("\tis in the first position");
			}
				else if(array_mo[x]=array_mo[2])
					{
						printf("\tis in the second position");
					}
					else if(array_mo[x]=array_mo[3])
						{
							printf("\tis in the third position");
						}
						else if(array_mo[x]=array_mo[4])
							{
								printf("\tis in the fourth position");
							}
							 else if(array_mo[x]=array_mo[5])
								{
									printf("\tis in the fifth position");
								}


return 0;
}


oh, again, I am using Borland Turbo C++ because that is what my whole class is using... :/

PLEASE I HOPE SOMEONE CAN HELP ME AGAIN... THANK YOU in advance...
In your second loop, you are looping from 1 and then jumping out when x == 2. Is that what you meant?
= assignment
== comparison

Weird indentation
Topic archived. No new replies allowed.