View Single Post
Old 09-20-2007, 09:34 AM   #1 (permalink)
Sarkoff
Recruit
 
Join Date: Jul 2007
Posts: 3
Sarkoff is on a distinguished road
Invalid Suffix "n" on integer constant error

For some reason with the code below I keep getting the error "15:48 C:\Documents and Settings\Brad\My Documents\My Homework\CSC 420 Fall 07\Test 1\5 - main.cpp invalid suffix "n" on integer constant " Why is it doing this? Any help would be appreciated.

Code:
#include<iostream>
#include<cmath>
using namespace std;

const double e = 2.718281828;
const double pi = 3.141592654;

double leftFunc(double n){
   return sqrt(2*pi*n)*pow((n/e), n);
}

double rightFunc(double n){
   return sqrt(2*pi*n)*pow((n/e), n) * (1 + 1/(12n-1));
}

double factorial(double n) {
	double temp;

	if(n <= 1.0) return 1.0;

	temp = n * factorial(n - 1.0);
	return temp;
}

int main(){
   double n = 1000;
   cout << leftFunc(n) << " < " << factorial(n) << " < " << rightFunc(n) << endl;
   
   cout << "Press Enter to Exit";
   cin.get();
   return 534;
}
Sarkoff is offline   Reply With Quote