No match for operator in 'std::cin <<input1' Won't compile.

Help guys, got this due in a couple hours and it is driving me nuts. I can't figure out the problem. I need to shift the values of 4 integers. I don't understand what I am doing wrong here.
Below is the exact error I am getting. If you notice anything wrong I am doing please say so. I am very unskilled in this sort of stuff. Thanks for the feedback and assistance guys.
../shift_2.cpp:35:7: error: no match for β€˜operator<<’ in β€˜std::cin << input1’

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * shift_1.cpp
 *
 *  Created on: Nov 1, 2012
 *      Author: shibby
 */
#include <iostream>
using namespace std;
/*Regular library*/
void get_numbers(int& input1,int& input2, int& input3, int& input4);
/*Reads the four integers*/
void swap_values(int& var1, int& var2, int& var3, int& var4);
/*These are the swap values that will change the
 * memory location. (I think thats how it works)*/
void show_results(int output1, int output2, int output3, int output4);
/*This will display the results in this order*/
int main ()
/*Main function*/
{
	int num1=0, num2=0, num3=0, num4=0;
	//Sets default values
	get_numbers(num1, num2, num3, num4);

	swap_values(num1, num2, num3, num4);

	show_results(num1, num2, num3, num4);
	return 0;
}
void get_numbers(int& input1,int& input2, int& input3, int& input4)
//Calls the get numbers function
{
	using namespace std;
	cout<<"Enter four integers: ";
/*Below is the problem that I am encountering*/
	cin<<input1<<input2<<input3<<input4;
}

void swap_values(int& var1, int& var2, int& var3, int& var4)
{
	int temp;
	temp=var1;
	var1=var2;
	var2=var3;
	var3=var4;
	var4=temp;
}

void show_results(int output1, int output2, int& output3, int& output4)
{
	using namespace std;
	cout<<"In a different order, the numbers are: ";
	cout<<output1<<" "<<output2<<" "<<output3<<" "<<output4<<endl;
}





EDIT: I'm an idiot. Wrong arrows for cin.
Still having issues with

/shift2/Debug/../shift_2.cpp:26: undefined reference to `show_results(int, int, int, int)'
Last edited on
Instead of

cin<<input1<<input2<<input3<<input4;

shall be

cin>>input1>>input2>>input3>>input4;
At first you declared the function as

void show_results(int output1, int output2, int output3, int output4);


but then you defined it as

void show_results(int output1, int output2, int& output3, int& output4)
{
Still having issues with

/shift2/Debug/../shift_2.cpp:26: undefined reference to `show_results(int, int, int, int)'


when you wrote the function declaration (on line 15) you said:
void show_results(int output1, int output2, int output3, int output4);


but when you wrote the function body (starting on line 48) - you wrote
void show_results(int output1, int output2, int& output3, int& output4)


Topic archived. No new replies allowed.