Welcome Guest (Register -  Login)  Active Topics Active Topics Display List of Forum Members Memberlist Search The Forum Search Help Help
 Navigation
 Skin Chooser

Choose Skin:


There are 2 skins total.
The newest skin is Classis Default

 Latest Forum Posts

Math and Physics
 C++ GamesMath and Physics
Subject Topic: Formula Post ReplyPost New Topic
 Formula
<< Prev Topic | Next Topic >>
fudgemaster
Posted: 20-June-2010 at 10:32pm | IP Logged Quote fudgemaster
Avatar
Newbie
Newbie


Group: Newbie
Joined: 31-January-2010
Location: Canada
Posts: 4
I'm learning C++ at the moment. I'm just toying around building things, experimenting with code and such. Right now I'm trying to make something that can calculate your chance of surviving a zombie outbreak. I currently have 3 variables (weight, age, speed) and am just trying to figure out a good formula for computing a chance(no greater than 100 or less than 0) of surviving. Here is the unfinished code I have:
using namespace std;
int main() {
//declare variables
int weight, speed, age;
//prompt for weight
cout <<"Hello! if you would like me to calculate your chance of surviving a zombie outbreak please input your weight";
    cin >> weight;
//make an auto fail for too much weight  
 if(weight>250)
        cout <<"You have no chance of surviving";
//prompt for speed variable
cout << "Please input your speed in MPH";
    cin >> speed;
//make an auto fail for to low of speed and to much weight(different than auto fail weight)  
 if(speed<10 && weight>200)
        cout <<"You won't survive.";
//prompt age
cout <<"Please input your age";
    cin>>age;
//make an auto fail for age 
if(age>65)
        cout<<"I doubt you will survive";
    cout << "Here is your chance of surviving a zombie outbreak!"; //this is where the formula comes in
    return 0;
}

Suggestions are appreciated. This is unfinished, which is why I haven't printed the chance which is why I want a good formula.Keep in mind I am just learning it and don't know, so if you can teach me something new that would be nice. Also copying and pasting the code kinda messed with the format of it so it doesn't look very pretty.
 
Online Status: Offline
View fudgemaster's Profile Search for other posts by fudgemaster Back to Top
 
skunkchop
Posted: 23-August-2010 at 12:41am | IP Logged Quote skunkchop

Newbie
Newbie


Group: Newbie
Joined: 22-August-2010
Posts: 1
This is my first post, I'd like to learn C++ too. Here is a
formula you could use, but this assumes that all three factors
are equal. This assumes 30 to be the upper limit of speed, and
20 to be the *best* age. I know this reply is very late, sorry.

Survival % = 66.6 + (speed - (0.017(age-20)^2+33.3) -
weight*8.25)

Needs a bit of tweaking, as it's really harsh.
 
Online Status: Offline
View skunkchop's Profile Search for other posts by skunkchop Back to Top
 
1 User(s) are browsing this topic, 1 Guest(s) and 0 Member(s)
0 Members:
<< Prev Topic Math and Physics Next Topic >>

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.2031 seconds.

[ Users browsing page: none ]



Terms and Conditions | Privacy | Contact Us

Copyright © 2010 Cpp Games. All rights reserved.

This site is best viewed at 1024x768 screen resolution.
Back to Top

Designed by Micronet Technologies