Original Post
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;
}
|