-
Programing error
so far my code looks like
Code:
//Coded by: Pwrade//////////////////////
////////////////////////////////////////
/////////////World of warcraft//////////
/////////////Formulas of Things/////////
////////////////////////////////////////
////////////////////////////////////////
#include <iostream>
using namespace std;
int main()
{
int Select;
int clvl;
int ap;
int Arm;
cout<< "==== Version 0.1 Alpha====\n";
cout<< "=========================\n";
cout<< "====Coded by: Pwrade=====\n";
cout<< "==========================\n ";
cout<< "\n";cout<< "\n";cout<< "\n";cout<< "\n";
cout<< "0- Attack Power\n";cout<< "1-Damage Reduction\n"; cout<< "2-exp\n";
cin>> Select;
cin.ignore();
if( Select == 0){
cout<< "Enter Your Attack Power";
cout<< "\n";
cin>> ap;
cin.ignore();
cout<< " your character does "<< ap/14 << "DPS(w/o weapon)" <<"\n";
if ( Select == 1){
cout<< " Please enter your Armor";
}
}
cin.get();
}
when i type 1 after i run it though nothing happens then it closes..help plz
-
Indentation is key to figuring out what is going on
Code:
#include <iostream>
using namespace std;
int main()
{
int Select;
int clvl;
int ap;
int Arm;
cout << "==== Version 0.1 Alpha====\n";
cout << "=========================\n";
cout << "====Coded by: Pwrade=====\n";
cout << "==========================\n ";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "0- Attack Power\n";
cout << "1-Damage Reduction\n";
cout << "2-exp\n";
cin >> Select;
cin.ignore();
if (Select == 0) {
cout << "Enter Your Attack Power";
cout << "\n";
cin >> ap;
cin.ignore();
cout << " your character does " << ap /
14 << "DPS(w/o weapon)" << "\n";
if (Select == 1) { //!! Can never happen, it's inside Select == 0
cout << " Please enter your Armor";
}
}
cin.get();
}
-
ahh thx = P didnt see that usually compiler tells me what i did wrong, thx again!
-
A compiler will never show you logical errors.