Write your question here. Hi, it is me again. I am getting this error and cannot figure out what I am doing wrong. It is in visual studios 2013 again BTW.
[#include "stdafx.h" // Precompiled header
#include "iostream" // Input and output stream
using namespace std; // Meaning you don't have to put std:: before cout <<;.
int squareIntegers(); // Function Prototype
double squareDouble();
float squareFloat();
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
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.
}
code]
Put the code you need help with here.
[/code]
So, I read it but and why are
[int squareIntegers(); // Function Prototype
double squareDouble();
float squareFloat();], wrong. They are function prototypes.
Also, I get an error saying to include "stdafx.h" if I don't include it.
Also, for squareIntegers(22), I used this in my last program, and it worked fine. I have no idea what else could be the issue.
Also, how do you use the tags. I click on <>, then this comes up: , but where in the brackets do I paste my code? I pasted in the brackets and it doesn't work. Is there a specific location in the brackets where I should paste my code?
#include "iostream" // Input and output stream
usingnamespace std; // Meaning you don't have to put std:: before cout <<;.
int squareIntegers(); // Function Prototype
double squareDouble();
float squareFloat();
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
}
double squareDouble(double d) {
double answer;
answer = d * d;
return answer;
}
float squareFloat(float x, float y) {
float answer1;
float answer2;
answer1 = x * x;
answer2 = y * y;
return 0;
}
errors:
(10): error C2660: 'squareIntegers' : function does not take 1 arguments
(11): error C2660: 'squareDouble' : function does not take 1 arguments
(12): error C2660: 'squareFloat' : function does not take 2 arguments
Because your prototypes should be:
1 2 3 4
int squareIntegers(int); // Function Prototype
double squareDouble(double);
float squareFloat(float, float);
Hmmmm.... Stange. I even copy and pasted the code you had and I am still getting the error:
"fatal error LNK1169: one or more multiply defined symbols found."
1) It says I have to return something in the squareFloat function, but whatever I return (even 0), it will show in the output display box? What can I return that will make nothing display?
2) How do I create spaces between numbers? For example, instead of 1213, how would I make this 12 13?