Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
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
Old 09-20-2007, 02:16 PM   #2 (permalink)
Sarkoff
Recruit
 
Join Date: Jul 2007
Posts: 3
Sarkoff is on a distinguished road
I realize my mistake

Sorry about that, I recognize my simple mistake now. There needs to be a * between 12 and n
Sarkoff is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 05:28 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting