How can I get rid of the zero in my output? The squareFloat function says I need to have a return value in that function.
[#include "stdafx.h"
#include "iostream" // Input and output stream
using namespace std; // Meaning you don't have to put std:: before cout <<;.
int squareIntegers(int); // Function Prototype
double squareDouble(double);
float squareFloat(float, float);
int main() //Main Function
{
cout << squareIntegers(22) << endl;
cout << squareDouble(12) << endl;
cout << squareFloat(132, 150) << endl; //Function call and display with value 22 (so x = 22)
system("pause"); // Helps with displaying the output of a program.
return 0; // Returns a value.
}
int squareIntegers(int x) { //Function
int solution; //Declaring the variable solution, which is an integer data type.
solution = x * x; // Squaring x.
return solution; //Returns solution
This is different, because it has two calculations. I have tried returning 0, -1. I don't know what to do and I have no choice but to return a value. Any suggestions?