Skip to main content
gamedev.net
🔒 Locked

Let's Play...name....that...BUG!!!!

Started by NightwingX 3 replies 600+ views
Original Post
NightwingX
NightwingX
I have something that seems not to work: If you know what I messed up - please tell me (THE CODE WILL NOT COMPILE) Syntax-Error
  
#include <iostream>
#include <conio.h>
using namespace std;

//Yay, I finally learned how to write code in messages!

class CodeIt (
public:
   CodeIt(); // Constructor

   int DoTheMath( int, int, int ); //Does the math

private:
   Const SetVal;      //Always use this set value

   Const SetModifier; // Modify it by another set value

}; //Class CodeIt


CodeIt::CodeIt()
{
   SetVal = 7;
   SetModifier = 3;
}

int DoTheMath( int X, int Y, int Z )
{
   //This is the encoder

   int NBuffer;   
   NBuffer = (SetVal * X) % SetModifier;
   //Test to see if there will be no divide by zero errors

   if (Z != 0) {   
      NBuffer = (NBuffer + Y) / Z
   }
   else {
      NBuffer = (NBuffer - Y) + Z
   }
   return NBuffer;
}

void main()
{
   int a, b, c, answer;   
   CodeIt ci;

   cout << "This program will encode the (blank) Value\n";
   // Sorry, I can''t tell WHAT value in encoded

   cout << "-------------------------------------------------\n";
   cout << endl;
   cout << "Enter 3 Values to get the final value: ";
   cin >> a >> b >> c;
   answer = ci.DoTheMath(a, b, c);
   system("cls")
   cout << "The original: " >> a >> "," >> b >> "," >> z is:\n"; 
   cout << "The converted: " >> answer >> endl;
}
  
MrDude
MrDude
your missing semi-colins after your if statements. you know: NBuffer = (NBuffer + Y) / Z

Grunt as much as possible today
-The zombie of the underworld, Mr. Dude
In capatalisim man exploits man, in socialism it's exactly the opposite
-Ben Tucker
pointguard1
pointguard1
First of all, you need to put a { - open curly brace instead of a ( - open parentheses after "class CodeIt". Secondly, you need ; semicolons after the statements ending with Z. They''re aren''t there. This may fix the problem but other things might still be wrong with your code. Sorry I didn''t check it all that well because I''m not all that great at debugging myself.
------------------------------------KaBeeM Web
<><
NightwingX
NightwingX

ARG!!!


Stupid me! I HATE DEBUGGING!!!

-Thanks

quote:
Wise Man On Hill Says:
Time to get MSVC++

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.