I'm new to this whole Visual Basic idea, and my questions may be newb for all of you, but I'd like to learn. Here is my question. At school I was given an assignment , which is:
Write a program which uses functions to accept as input from the key board 3 integers and print them out in order from smallest to largest.
the program should use 3 functions
1. getdata -- will read and echo the input
2. sort -- will put the numbers in order
3. print -- will print the numbers to the screen
I want to know how to sort the three integers from user input. Would I just use a series of "if" statements?
This is what I have so far:
// Excercise 2 no.2.cpp : Defines the entry point for the console application.
//
// ***** Includes *****
#include "stdafx.h"
using namespace std;
// ***** Function Prototypes *****
void getData();
void sortData();
void printScreen();
void printClosing();
int input1, input2, input3;
void main()
{ // startmain
// ***** Input integers from keyboard *****
getData();
// ***** Sort data inputted from keyboard *****
sortData();
// ***** Print results to screen*****
printScreen();
// ***** Closing message *****
printClosing();
} // end main
void getData()
{ // start getData
cout << "Please enter three integer values:\n";
cin >> input1;
cin >> input2;
cin >> input3;
} // end getData
void sortData()
{ // start sortData
} // end sortData
void printScreen()
{ // start printScreen
} // end printScreen
void printClosing()
{ // start printClosing
int wait;
cout << "\nPlease enter any key to exit.\n";
cin >> wait;
cout << endl;
} // end printClosing
I know it's short and I have next to nothing, but please help me with this.
<< moderator edit: added [code][/code] tags >>