Code:
#include <iostream>
#include <stdlib.h>
using namespace std;
int main(); //Took an error out when I added semicolon
float p(int i)
{
if( i < 10 && i > 1 )
{
int x = i*i;
int y; ///Needed variable int
float z; ///Forgot semicolon
cout << "enter a number" << endl;
cin >> z;
return z / (float)x;
}
return 1.0;
}
That fixed it when I compiled. I got these 2 errors when I tried to build however.
Code:
Compiling...
Cpp1.cpp
c:\compiled\float\cpp1.cpp(14) : warning C4101: 'y' : unreferenced local variable
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Cpp1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Cpp1.exe - 2 error(s), 1 warning(s)
I might be wrong just trying to help though