online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <iomanip> #include <string.h> #include <cmath> using namespace std; void commercial(); void fighter(); void airbus1(); void airbus2(); void boeing1(); void boeing2(); void gulf1(); void f16(); void f111(); void f35(); void phantom(); void thunder(); int main(void) { //Assuming zero drag char plane[100]; cout<<"Pick a plane with either a turbo fan(commercial) or turbo jet(fighter): "; cin>>plane; if(strcmp(plane,"commercial")==0){ commercial(); } if(strcmp(plane,"fighter")==0){ fighter(); } return 0; } void commercial(){ int x; cout<<"Pick from this list:"<< endl; cout<<"1. Airbus a380"<<endl; cout<<"2. Airbus a321"<<endl; cout<<"3. Boeing 737"<<endl; cout<<"4. Boeing 747"<<endl; cout<<"5. Gulfstream C7650"<<endl; cout<<"Enter a number for plane: "; cin>>x; switch(x){ case 1: airbus1(); break; case 2: airbus2(); break; case 3: boeing1(); break; case 4: boeing2(); break; case 5: gulf1(); break; } return; } void fighter(){ cout<<"Pick from this list:"<< endl; cout<<"1. F-16"<<endl; cout<<"2. F-111 Aardvark"<<endl; cout<<"3. F-35 Lightning"<<endl; cout<<"4. F-4 Phantom"<<endl; cout<<"5. A-10 Thunderbolt"<<endl; cout<<"Enter a number for plane: "; int choice; cin>>choice; switch(choice){ case 1: f16(); break; case 2: f111(); break; case 3: f35(); break; case 4: thunder(); break; case 5: phantom(); break; } } void airbus1(){ double runway; double speed = 559.2; double maxWeight = 727000; cout<<"Knowing that the max weight of the this plane is "<<maxWeight<<" lbs and the max speed is "<<speed<<" mph."<<endl<<"How long do you think the runway needs to be to accomodate takeoff(in meters)? :"; cin>>runway; double time = runway/speed; double velocity = runway/time; double WA = 845.0; double lift = (0.5*0.95)*(velocity*velocity)*WA *0.68; cout<<"The lift is "<<lift<<" N "; if(runway>3300) cout<<"and your plane successfully takes off"; else cout<<"but runway is not long enough for takeoff"; return; } void airbus2(){ double runway; double speed = 562; double maxWeight = 205030; cout<<"Knowing that the max weight of the this plane is "<<maxWeight<<" lbs and the max speed is "<<speed<<" mph."<<endl<<"How long do you think the runway needs to be to accomodate takeoff(in meters)? :"; cin>>runway; double time = runway/speed; double velocity = runway/time; double WA = 122.6; double lift = (0.5*0.95)*(velocity*velocity)*WA *0.68; cout<<"The lift is "<<lift<<" N "; if(runway>1900) cout<<"and your plane successfully takes off"; else cout<<"but runway is not long enough for takeoff"; return; } void boeing1(){ double runway; double speed = 545; double maxWeight = 174200; cout<<"Knowing that the max weight of the this plane is "<<maxWeight<<" lbs and the max speed is "<<speed<<" mph."<<endl<<"How long do you think the runway needs to be to accomodate takeoff(in meters)? :"; cin>>runway; double time = runway/speed; double velocity = runway/time; double WA = 124.6; double lift = (0.5*0.95)*(velocity*velocity)*WA *0.68; cout<<"The lift is "<<lift<<" N "; if(runway>1700) cout<<"and your plane successfully takes off"; else cout<<"but runway is not long enough for takeoff"; return; } void boeing2(){ double runway; double speed = 583; double maxWeight = 900000; cout<<"Knowing that the max weight of the this plane is "<<maxWeight<<" lbs and the max speed is "<<speed<<" mph."<<endl<<"How long do you think the runway needs to be to accomodate takeoff(in meters)? :"; cin>>runway; double time = runway/speed; double velocity = runway/time; double WA = 541.2; double lift = (0.5*0.95)*(velocity*velocity)*WA *0.68; cout<<"The lift is "<<lift<<" N "; if(runway>3500) cout<<"and your plane successfully takes off"; else cout<<"but runway is not long enough for takeoff"; return; } void gulf1(){ double runway; double speed = 610.19; double maxWeight = 99600; cout<<"Knowing that the max weight of the this plane is "<<maxWeight<<" lbs and the max speed is "<<speed<<" mph."<<endl<<"How long do you think the runway needs to be to accomodate takeoff(in meters)? :"; cin>>runway; double time = runway/speed; double velocity = runway/time; double WA = 119.2; double lift = (0.5*0.95)*(velocity*velocity)*WA *0.68; cout<<"The lift is "<<lift<<" N "; if(runway>1000) cout<<"and your plane successfully takes off"; else cout<<"but runway is not long enough for takeoff"; return; } void f16(){ double runway; double speed = 1498; double maxWeight = 42000; cout<<"Knowing that the max weight of the this plane is "<<maxWeight<<" lbs and the max speed is "<<speed<<" mph."<<endl<<"How long do you think the runway needs to be to accomodate takeoff(in meters)? :"; cin>>runway; double time = runway/speed; double velocity = runway/time; double WA = 27.87; double lift = (0.5*0.95)*(velocity*velocity)*WA *0.68; cout<<"The lift is "<<lift<<" N "; if(runway>750) cout<<"and your plane successfully takes off"; else cout<<"but runway is not long enough for takeoff"; return; } void f111(){ double runway; double speed = 1650; double maxWeight = 100002; cout<<"Knowing that the max weight of the this plane is "<<maxWeight<<" lbs and the max speed is "<<speed<<" mph."<<endl<<"How long do you think the runway needs to be to accomodate takeoff(in meters)? :"; cin>>runway; double time = runway/speed; double velocity = runway/time; double WA = 61.07; double lift = (0.5*0.95)*(velocity*velocity)*WA *0.68; cout<<"The lift is "<<lift<<" N "; if(runway>1000) cout<<"and your plane successfully takes off"; else cout<<"but runway is not long enough for takeoff"; return; } void f35(){ double runway; double speed = 1199; double maxWeight = 60000; cout<<"Knowing that the max weight of the this plane is "<<maxWeight<<" lbs and the max speed is "<<speed<<" mph."<<endl<<"How long do you think the runway needs to be to accomodate takeoff(in meters)? :"; cin>>runway; double time = runway/speed; double velocity = runway/time; double WA = 42.7; double lift = (0.5*0.95)*(velocity*velocity)*WA *0.68; cout<<"The lift is "<<lift<<" N "; if(runway>830) cout<<"and your plane successfully takes off"; else cout<<"but runway is not long enough for takeoff"; return; } void phantom(){ double runway; double speed = 1473; double maxWeight = 60000; cout<<"Knowing that the max weight of the this plane is "<<maxWeight<<" lbs and the max speed is "<<speed<<" mph."<<endl<<"How long do you think the runway needs to be to accomodate takeoff(in meters)? :"; cin>>runway; double time = runway/speed; double velocity = runway/time; double WA = 49.2; double lift = (0.5*0.95)*(velocity*velocity)*WA *0.68; cout<<"The lift is "<<lift<<" N "; if(runway>830) cout<<"and your plane successfully takes off"; else cout<<"but runway is not long enough for takeoff"; return; } void thunder(){ double runway; double speed = 439; double maxWeight = 51000; cout<<"Knowing that the max weight of the this plane is "<<maxWeight<<" lbs and the max speed is "<<speed<<" mph."<<endl<<"How long do you think the runway needs to be to accomodate takeoff(in meters)? :"; cin>>runway; double time = runway/speed; double velocity = runway/time; double WA = 47.0; double lift = (0.5*0.95)*(velocity*velocity)*WA *0.68; cout<<"The lift is "<<lift<<" N "; if(runway>775) cout<<"and your plane successfully takes off"; else cout<<"but runway is not long enough for takeoff"; return; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue