** For my homework assignment in C++, my goal is to write a program the inputs three integers and passes them to a function that returns the smallest number. This is only my 3rd week of C++, so I don't know much.**
In addition, I'm only allowed to start off with #include and using namespace std.
This is what I have so far:
#include <iostream>
using namespace std;
int fsmallestNumber(int);
int main() {
int numberOne;
int numberTwo;
int numberThree;
int smallestNumber;
cout << "Enter in 3 numbers and I will find the smallest of all three" << endl;
cin >> numberOne >> numberTwo >> numberThree;
cout << "The smallest of all three numbers is " << smallestNumber << endl;
}
int fsmallestNumber(int sn){
}
I'm confused on how to use the if/else statements to find the smallest number, and how to return the smallest number back into the function to print it out.
Aucun commentaire:
Enregistrer un commentaire