I am getting an error in my debugging that i dont understand. I dont even know how to end code yet...I'm 2 days into learning C++ so im not even sure the last section is correct yet.
This is the debug output.
I think the error refers to the section of code that looks likeCode:1>c:\users\****\documents\visual studio 2008\projects\char\char\char.cpp(143) : fatal error C1075: end of file found before the left brace '{' at 'c:\users\****\documents\visual studio 2008\projects\char\char\char.cpp(11)' was matchedTowards the bottom.Code:if (cPoints > 0)
Here is my code.
Code:// Char.cpp : Defines the entry point for the cConsole application. // #include "stdafx.h" #include <iostream> #include <ctime> #include <string> using namespace std; int main() { string cName; int cLeftOver; int cStr; int cIntel; int cAgi; int cCon; int cSpe; int cNin; int cPoints; cStr = 0; cIntel = 0; cAgi = 0; cCon = 0; cSpe = 0; cNin = 0; cPoints = 100; cout << "It's time to name your character! Please type your characters name: "; getline(cin, cName); cout << "Welcome to the game " << cName << "!" << endl << "You have 100 Character points to spend." << endl << "These points will be applied to your characters attributes. Lets begin!" << endl << endl; cout << "---------------------------------" << endl; cout << "Strength: " << cStr << endl << "Intelligence: " << cIntel << endl << "Agility: " << cAgi << endl << "Constitution: " << cCon << endl << "Speed: " << cSpe << endl << "NinJutsu: " << cNin << endl; cout << "---------------------------------" << endl << endl; cout << "Strength is the attribute that applies to how much damage your mutant does." << endl << "How much strength would you like? (1-25)" << endl; cin >> cStr; if (cStr > 25) { cout << "You're trying to set your Strength too high. Please choose between 1 and 25." << endl; cin >> cStr; } cPoints = cPoints - cStr; cout << endl << "You have " << cPoints << " points left!" << endl; cout << "---------------------------------" << endl; cout << "Strength: " << cStr << endl << "Intelligence: " << cIntel << endl << "Agility: " << cAgi << endl << "Constitution: " << cCon << endl << "Speed: " << cSpe << endl << "NinJutsu: " << cNin << endl; cout << "---------------------------------" << endl << endl; cout << "Intelligence effects your ability to learn new skills and become stronger at those skills." << endl << "How much intelligence would you like? (1-25)" << endl; cin >> cIntel; if (cIntel > 25) { cout << "You're trying to set your intelligence too high...which isnt very intelligent! Please choose between 1 and 25." << endl; cin >> cIntel; } cPoints = cPoints - cIntel; cout << endl << "You have " << cPoints << " points left!" << endl; cout << "---------------------------------" << endl; cout << "Strength: " << cStr << endl << "Intelligence: " << cIntel << endl << "Agility: " << cAgi << endl << "Constitution: " << cCon << endl << "Speed: " << cSpe << endl << "NinJutsu: " << cNin << endl; cout << "---------------------------------" << endl << endl; cout << "Agility affects how well your character can land attacks." << endl << "How much agility would you like? (1-25)" << endl; cin >> cAgi; if (cAgi > 25) { cout << "You're trying to set your agility too high! Please choose between 1 and 25." << endl; cin >> cAgi; } cPoints = cPoints - cAgi; cout << endl << "You have " << cPoints << " points left!" << endl; cout << "---------------------------------" << endl; cout << "Strength: " << cStr << endl << "Intelligence: " << cIntel << endl << "Agility: " << cAgi << endl << "Constitution: " << cCon << endl << "Speed: " << cSpe << endl << "NinJutsu: " << cNin << endl; cout << "---------------------------------" << endl << endl; cout << "Constitution is what determines your HP and resistance to poisons" << endl << "How much constitution would you like? (1-25)" << endl; cin >> cCon; if (cCon > 25) { cout << "You're trying to set your intelligence too high...which isnt very intelligent! Please choose between 1 and 25." << endl; cin >> cCon; } cPoints = cPoints - cCon; cout << endl << "You have " << cPoints << " points left!" << endl; cout << "---------------------------------" << endl; cout << "Strength: " << cStr << endl << "Intelligence: " << cIntel << endl << "Agility: " << cAgi << endl << "Constitution: " << cCon << endl << "Speed: " << cSpe << endl << "NinJutsu: " << cNin << endl << endl; cout << "---------------------------------" << endl << endl; cout << "Speed allows your character to land attacks sooner and more often" << endl << "How much speed would you like? (1-25)" << endl; cin >> cSpe; if (cSpe > 25) { cout << "You're trying to set your speed too high. Please choose between 1 and 25." << endl; cin >> cSpe; } cPoints = cPoints - cSpe; cout << endl << "You have " << cPoints << " points left!" << endl; cout << "---------------------------------" << endl; cout << "Strength: " << cStr << endl << "Intelligence: " << cIntel << endl << "Agility: " << cAgi << endl << "Constitution: " << cCon << endl << "Speed: " << cSpe << endl << "NinJutsu: " << cNin << endl; cout << "---------------------------------" << endl << endl; cout << "NinJutsu allows you to learn elite and secret techniques to attack your enemies with" << endl << "How much NinJutsu would you like? (1-25)" << endl; cin >> cNin; if (cNin > 25) { cout << "You're trying to set your NinJutsu too high. Please choose between 1 and 25." << endl; cin >> cNin; } cPoints = cPoints - cNin; cout << endl << "You have " << cPoints << " points left!" << endl; cout << "---------------------------------" << endl; cout << "Strength: " << cStr << endl << "Intelligence: " << cIntel << endl << "Agility: " << cAgi << endl << "Constitution: " << cCon << endl << "Speed: " << cSpe << endl << "NinJutsu: " << cNin << endl; cout << "---------------------------------" << endl << endl; if (cPoints > 0) { cout << "You did not spend all of your character points! You may still use " << cPoints << " points." << endl << "Which attribute would you like to add points to?" << endl; cout << "---------------------------------" << endl; cout << "1: Strength" << endl << "2: Intelligence" << endl << "3: Agility" << endl << "4: Constitution" << endl << "5: Speed" << endl << "6: Ninjutsu" << endl << "Please type the number corresponding with the attribute you want to change" << endl; cout << "---------------------------------" << endl; cin >> cLeftOver; if (cLeftOver = 1) { cout << "Strength is the attribute that applies to how much damage your mutant does." << endl << "How much strength would you like? (1-25)" << endl; cin >> cStr; if (cStr > 25) { cout << "You're trying to set your Strength too high. Please choose between 1 and 25." << endl; cin >> cStr; } cPoints = cPoints - cStr; cout << endl << "You have " << cPoints << " points left!" << endl; cout << "---------------------------------" << endl; cout << "Strength: " << cStr << endl << "Intelligence: " << cIntel << endl << "Agility: " << cAgi << endl << "Constitution: " << cCon << endl << "Speed: " << cSpe << endl << "NinJutsu: " << cNin << endl; cout << "---------------------------------" << endl << endl; } system ("PAUSE"); }



LinkBack URL
About LinkBacks


