Title: runescape calculator
jgelderloos - May 13, 2005 03:11 AM (GMT)
hey,
if any of you are familiar with the RPG runescape this is for you.
i dont really play the game at all any more but i decided to make this for practice.
this is a calculator for the mining skill in runescape. right now i just started and i only plan on doing levels 1-20 b/c up to 99 qould take way to long. and right now its only up to 2 levels but ill update
| CODE |
#include<iostream> using namespace std;
int main() { char again = 'y'; while (again=='y' || again=='Y')
{ cout<<"..:Mining Calculator level 1-20::.."<<endl; cout<<"Enter your desired level(1-20)"<<endl; int lvl; cin>>lvl; switch(lvl) { int exp; case 1: cout<<"Enter your current experience"<<endl; cin>>exp; cout<<"You need to gain "<<(83 - exp)<<endl; break; case 2: cout<<"Enter your current experience"<<endl; cin>>exp; cout<<"You need to gain "<<(174 - exp)<<endl; break; default: exit(0); } cout<<"Do you want to do it again?(Y/N)"<<endl; cin>>again; system("cls"); } return 0; } |
and whoever it was who made the area program that helped me out with the again loop so thanks
shadow382 - May 24, 2005 06:23 AM (GMT)
As soon as I press enter, after entering my level, the program closes. You may want to fix that little problem. Or maybe I'm doing something wrong.
-Shadow382 :dj:
donprogc++ - May 24, 2005 02:29 PM (GMT)
you would just have to add this
or this
to the end
C-Man - May 24, 2005 02:33 PM (GMT)
[offtopic]
Don you said you wanted to see my bootsector when it's finished
well it's finished and posted 3 days now and you havent checked it yet
[/offtopic]
myork - May 24, 2005 03:13 PM (GMT)
| QUOTE (donprogc @ ++May 24 2005, 09:29 AM) |
you would just have to add this
or this
to the end
|
A few weeks ago we had a problem with this (because of bad input).
Did we not come up with a solution that KTC was going to put in the FAQ after exams.
Without looking it up did it no go somthing like this:
| CODE |
if (!cin.good()) { cin.<CORRECT BAD FLAG>(); } cin.flush(); // or not cin.get(); |
DOOM - July 19, 2005 12:27 AM (GMT)
use cin.get()
it is alot better, it doesn't say : "press anykey....";
here:
| CODE |
#include<iostream> using namespace std;
int main() { char again = 'y'; while (again=='y' || again=='Y')
{ cout<<"..:Mining Calculator level 1-20::.."<<endl; cout<<"Enter your desired level(1-20)"<<endl; int lvl; cin>>lvl; switch(lvl) { int exp; case 1: cout<<"Enter your current experience"<<endl; cin>>exp; cout<<"You need to gain "<<(83 - exp)<<endl; break; case 2: cout<<"Enter your current experience"<<endl; cin>>exp; cout<<"You need to gain "<<(174 - exp)<<endl; break; default: exit(0); } cout<<"Do you want to do it again?(Y/N)"<<endl; cin>>again; cin.get(); } return 0; } |
and then it rocks!
great job btw..
master - August 13, 2005 09:25 PM (GMT)
nontitle - August 17, 2005 07:44 PM (GMT)
i recommend you add a "system("cls");" to the end of the loop (after cin.get). that way it doesn't take up much space in the console window
nontitle - August 17, 2005 08:29 PM (GMT)
as well i could build up an include file that will make it work up to 99 then tell you how to use it (just to let you know at this point i havent started it yet)
Rmstn1580 - December 5, 2005 05:21 AM (GMT)
| QUOTE (donprogc++ @ May 24 2005, 02:29 PM) |
you would just have to add this
or this
to the end
|
That won't work in some older compilers. I had an older version of Dev-C++ (I just upgraded) and it didn't accept cin.get(); as a valid function. I had to type system("PAUSE"); return 0;
myork - December 5, 2005 01:52 PM (GMT)
| QUOTE (Rmstn1580 @ Dec 5 2005, 12:21 AM) |
| That won't work in some older compilers. I had an older version of Dev-C++ (I just upgraded) and it didn't accept cin.get(); as a valid function. I had to type system("PAUSE"); return 0; |
Remember it is in the standard namespace so you would need to use:
Or add a using statment.