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;
}
|