this is what i could make out of what i learned.
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
void survivalcraft();
void runCalculator();
int a = 0;
int b = 0;
char keepGoing= ' ';
char redo= ' ';
string userOp100;
string userOp101;
string password= "password";
char pass= ' ';
string user= "";
string town= "";
int userOp,userOp2,userOp3,userOp4,userOp5,userOp6,userOp200;
int adding (int a, int B)/>;
int adding (int a, int B)/>{
int sum= 0;
sum= a + b;
return sum;
}
int subtracting (int a, int B)/>{
int difference= 0;
difference= a - b;
return difference;
}
int multiply ( int a, int B)/>{
int multiplied= 0;
multiplied= a *b;
return multiplied;
}
int dividing ( int a, int B)/>{
int divide= 0;
divide= a / b;
return divide;
}
void runCalculator(){
cout<< "Welcome"<<endl;
do{
do{
cout << "-------------------------------------------------------------"<<endl;
cout << "/////////Calculator////////"<<endl;
cout << "-------------------------------------------------------------"<<endl;
cout << "Type in 2 numbers" << endl;
cin >> a >> b;
cout<< "Your numbers are.."<<endl;
cout << a << endl;
cout << b << endl;
cout << "-------------------------------------------------------------"<<endl;
cout <<"If there was an error, Press E to redo, if not press any other key then enter" <<endl;
cin >> redo;
}while(redo == 'e' || redo == 'E');
cout << "Press 1 to Add, 2 to Subtract, 3 to Divide, 4 to Multiply" << endl;
cin >>userOp100;
if(userOp100 == "1"){
cout<< adding (a,B)/><<endl;
}
if(userOp100 == "2"){
cout << subtracting (a,B)/><<endl;
}
if(userOp100 == "3"){
cout << dividing (a,B)/><<endl;
}
if(userOp100 == "4"){
cout << multiply (a,B)/><<endl;
}
cout << "Would you like to use the Calculator again press Y, Press any other key to end"<<endl;
cout<< "calculator : " << endl;
cin >> keepGoing;
}while(keepGoing == 'y' || keepGoing == 'Y');
}
//---------------------------------------------------------------------------------------------------------------------
void survivalcraft(){
string user;
cout << "-------------------------------------------------------------"<<endl;
cout << "SurvivalCraft " << endl;
cout << "-------------------------------------------------------------"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout << "Welcome" <<endl;
cout<<""<<endl;
cout<< " You were flying in a flan's airplane with your friend. Then out of the blue your engine randomly stopped"<<endl;
cout<< "and you crashed into the ground." <<endl;
cout<< "When you wake up, your friend was gone and your plane was burnt to the ground";
cout<< "The only tools you have are your two bare hands."<<endl;
cout<< "But you also can chop down trees, sand,stone, and many more objects with your hands."<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<" It looks pretty dark out. Will you make a shelter out of dirt or will you look around for"<<endl;
cout<<" some resources"<<endl;
cout<<" Press 1 to make a shelter or 2 to go look for some resources"<<endl;
cin >> userOp;
if(userOp == 1){
cout << "-------------------------------------------------------------"<<endl;
cout << "You decided to make a small shelter out of dirt." << endl;
cout << "-------------------------------------------------------------"<<endl;
cout << " You go to sleep and awake early in the morning"<<endl;
cout << "You look around and you seem fine, but you see that you are starving"<<endl;
cout << "You hear something outside of your dirt home...."<<endl;
cout << "Will you go outside and check what is making that noise"<<endl;
cout << "Or Will you stay inside for a few hours until the noise leaves"<<endl;
cout << "Press 1 to Go Outside or 2 to stay inside for a little bit"<<endl;
cin >> userOp2;
if(userOp2 == 1){
cout << "-------------------------------------------------------------"<<endl;
cout << "You check to see what is outside."<<endl;
cout << "-------------------------------------------------------------"<<endl;
cout << " When you step outside, an group of monsters start to chase you"<<endl;
cout << "you run and your run, and you come across a cave and you hide in it"<<endl;
cout << "you come to a choice.. make a run for it back into the dirt home"<<endl;
cout << "or camp out in the cave for a little"<<endl;
cout << " Press 1 for stay in the cave or Press 2 to make a run for it"<<endl;
cin >> userOp3;
if(userOp3 == 1){
cout << "-------------------------------------------------------------"<<endl;
cout << " You choosen to stay in the cave"<<endl;
cout << "-------------------------------------------------------------"<<endl;
cout << " You camp out for a small amount of time. But you get a little"<<endl;
cout << "sleepy. When you close your eyes, a zombie eats and kills you instantly"<<endl;
cout << "-------------------------------------------------------------"<<endl;
cout << " GAME OVER"<<endl;
cout << "-------------------------------------------------------------"<<endl;
exit(0);
}
else if(userOp3 == 2){
cout << "-------------------------------------------------------------"<<endl;
cout << "You make a run for it to your dirt home"<<endl;
cout << "-------------------------------------------------------------"<<endl;
cout << " You run and you run and you get shot at with arrows by skeletons"<<endl;
cout << " But luckily an arrow just misses you when you close the opening of your home"<<endl;
}
else{
cout << "-------------------------------------------------------------"<<endl;
cout << "INVALID"<<endl;
cout << "-------------------------------------------------------------"<<endl;
}
}//second if--------------------------------------------------------------------------
else if(userOp2 == 2){
cout << "-------------------------------------------------------------"<<endl;
cout << "You decided to stay inside"<<endl;
cout << "-------------------------------------------------------------"<<endl;
}//second else------------------------------------------------------------------------
else{
cout << "-------------------------------------------------------------"<<endl;
cout << "INVALID" <<endl;
cout << "-------------------------------------------------------------"<<endl;
}
}//First if -----------------------------------new--------------------------------------------------
else if(userOp == 2){
cout << "-------------------------------------------------------------"<<endl;
cout << "You decided to go look for some resources " << endl;
cout << "-------------------------------------------------------------"<<endl;
cout << " You go to look for resources, but you hear scary noise, sadly"<<endl;
cout << "you force yourself to make a dirt home to stay in because you know you are"<<endl;
cout << "not ready for the danger"<<endl;
}//first else
else{
cout << "-------------------------------------------------------------"<<endl;
cout << "INVALID" << endl;
cout << "-------------------------------------------------------------"<<endl;
}
cout << ""<<endl;
cout << ""<<endl;
cout << ""<<endl;
cout << ""<<endl;
cout << ""<<endl;
cout << "---------------------------------------------------------------------------------"<<endl;
cout << " So your in your home and it is about noon, and you know it is safe to go outside"<<endl;
cout << "---------------------------------------------------------------------------------"<<endl;
cout << " After a while the sun is up you can see all the plants, tree, terrain, and animals!"<<endl;
cout << "You collect some wood and kill some cows, chickens, and sheep."<<endl;;
cout << "Then, you come across this village"<<endl;
cout << "You ask around where am I, but you get no reply"<<endl;
cout << "Then you hear a man say 'Over hear'"<<endl;
cout << "The man says if you come with me I can help you."<<endl;
cout << " Pres 1 To not trust the man, Press 2 to trust him"<<endl;
cin >> userOp4;
if(userOp4 == 1){
cout << " You have decided, to not to trust the villager"<<endl;
}
else if(userOp4 == 2){
cout << "You have decided to trust the unfamiliar villiager"<<endl;
cout << "you followed the villager in a dark tunnel and your are stabbed to death."<<endl;
cout << "GAME OVER"<<endl;
exit(0);
}
cout << " So you decided to look around and see if anyone else would talk"<<endl;
cout << "when your about to leave a little boy come up to you"<<endl;
cout << "The little boy says, who are you?"<<endl;
cout << "you say"<<endl;
cout << "My name is ";
cin >> user;
cout << " The little boy says where are you from?"<<endl;
cout << "you say you are from"<<endl;
cin >> town;
cout << "Then the little boy says, yeah! No one talked to you because we though"<<endl;
cout << "you were from the nether"<<endl;
cout << " The the little boys says, to the villagers, he's not from the nether"<<endl;
cout << "then the villagers are not longer scared of you and speak to you."<<endl;
cout << " The villagers tell you how another man just like you lives in the southern part of the village"<<endl;
cout << " It is your friend who you lost!"<<endl;
cout << "he must of come upon the village when you were asleep"<<endl;
cout << "your friend has a good established home and offers if you like to stay with him"<<endl;
cout << " Again it looks really dark"<<endl;
cout << " Press 1 if you want to go home snd get your stuff or Press 2 to forget about your old belongings"<<endl;
cin >> userOp5;
if(userOp5==1){
cout << "When you walk a good distance to see your house, you are killed by a creepr sneaking up behind you"<<endl;
exit(0);
}
else if(userOp5==2){
cout << "You forget about your stuff and stay with your friend"<<endl;
}
cout << "Your friend tells you he have salvaged enough items to create a new plane and fly away" <<endl;
cout << " Do you want to leave the amazing unknown land you have come upon?"<<endl;
cout << " If you want to leave press 1, If you don't want to leave press 2"<<endl;
cin >> userOp6;
if(userOp6==1){
cout << " You leave and tell your friends all about your journey, have"<<endl;
exit(0);
}
else if(userOp6==2){
cout << "You stay with the villages and begin you life in a whole new world and you find out"<<endl;
cout << "The world is called MINECRAFT"<<endl;
exit(0);
}
}
int main(void){
cout << "---------------------------------------------------------------------------------"<<endl;
do{
cout << " Please enter password"<<endl;
cout << "-------------------------------------------------------------"<<endl;
cin >>userOp101;
cout << "---------------------------------------------------------------------------------"<<endl;
if(userOp101 != password){
cout<< " Incorrect Retry "<<endl;
}}while( userOp101 != password);
cout <<"What Would you like to do ?"<<endl;
cout <<" 1 for Calculator, 2 for SurvivalCraft"<<endl;
cin >> userOp200;
if(userOp200 == 1){
runCalculator();
}
else if(userOp200 == 2){
survivalcraft();
}
return 0;
}
can you tell me where to go from now?
yes i plan on mastering c++, so i can move into game programming, modeling, etc...
I went to a camp called internal drive, wanting to learn as much c++ as i could their. We used visual c++,
this is what i could make out of what i learned.
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
void survivalcraft();
void runCalculator();
int a = 0;
int b = 0;
char keepGoing= ' ';
char redo= ' ';
string userOp100;
string userOp101;
string password= "password";
char pass= ' ';
string user= "";
string town= "";
int userOp,userOp2,userOp3,userOp4,userOp5,userOp6,userOp200;
int adding (int a, int B)/>;
int adding (int a, int B)/>{
int sum= 0;
sum= a + b;
return sum;
}
int subtracting (int a, int B)/>{
int difference= 0;
difference= a - b;
return difference;
}
int multiply ( int a, int B)/>{
int multiplied= 0;
multiplied= a *b;
return multiplied;
}
int dividing ( int a, int B)/>{
int divide= 0;
divide= a / b;
return divide;
}
void runCalculator(){
cout<< "Welcome"<<endl;
do{
do{
cout << "-------------------------------------------------------------"<<endl;
cout << "/////////Calculator////////"<<endl;
cout << "-------------------------------------------------------------"<<endl;
cout << "Type in 2 numbers" << endl;
cin >> a >> b;
cout<< "Your numbers are.."<<endl;
cout << a << endl;
cout << b << endl;
cout << "-------------------------------------------------------------"<<endl;
cout <<"If there was an error, Press E to redo, if not press any other key then enter" <<endl;
cin >> redo;
}while(redo == 'e' || redo == 'E');
cout << "Press 1 to Add, 2 to Subtract, 3 to Divide, 4 to Multiply" << endl;
cin >>userOp100;
if(userOp100 == "1"){
cout<< adding (a,B)/><<endl;
}
if(userOp100 == "2"){
cout << subtracting (a,B)/><<endl;
}
if(userOp100 == "3"){
cout << dividing (a,B)/><<endl;
}
if(userOp100 == "4"){
cout << multiply (a,B)/><<endl;
}
cout << "Would you like to use the Calculator again press Y, Press any other key to end"<<endl;
cout<< "calculator : " << endl;
cin >> keepGoing;
}while(keepGoing == 'y' || keepGoing == 'Y');
}
//---------------------------------------------------------------------------------------------------------------------
void survivalcraft(){
string user;
cout << "-------------------------------------------------------------"<<endl;
cout << "SurvivalCraft " << endl;
cout << "-------------------------------------------------------------"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout << "Welcome" <<endl;
cout<<""<<endl;
cout<< " You were flying in a flan's airplane with your friend. Then out of the blue your engine randomly stopped"<<endl;
cout<< "and you crashed into the ground." <<endl;
cout<< "When you wake up, your friend was gone and your plane was burnt to the ground";
cout<< "The only tools you have are your two bare hands."<<endl;
cout<< "But you also can chop down trees, sand,stone, and many more objects with your hands."<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<" It looks pretty dark out. Will you make a shelter out of dirt or will you look around for"<<endl;
cout<<" some resources"<<endl;
cout<<" Press 1 to make a shelter or 2 to go look for some resources"<<endl;
cin >> userOp;
if(userOp == 1){
cout << "-------------------------------------------------------------"<<endl;
cout << "You decided to make a small shelter out of dirt." << endl;
cout << "-------------------------------------------------------------"<<endl;
cout << " You go to sleep and awake early in the morning"<<endl;
cout << "You look around and you seem fine, but you see that you are starving"<<endl;
cout << "You hear something outside of your dirt home...."<<endl;
cout << "Will you go outside and check what is making that noise"<<endl;
cout << "Or Will you stay inside for a few hours until the noise leaves"<<endl;
cout << "Press 1 to Go Outside or 2 to stay inside for a little bit"<<endl;
cin >> userOp2;
if(userOp2 == 1){
cout << "-------------------------------------------------------------"<<endl;
cout << "You check to see what is outside."<<endl;
cout << "-------------------------------------------------------------"<<endl;
cout << " When you step outside, an group of monsters start to chase you"<<endl;
cout << "you run and your run, and you come across a cave and you hide in it"<<endl;
cout << "you come to a choice.. make a run for it back into the dirt home"<<endl;
cout << "or camp out in the cave for a little"<<endl;
cout << " Press 1 for stay in the cave or Press 2 to make a run for it"<<endl;
cin >> userOp3;
if(userOp3 == 1){
cout << "-------------------------------------------------------------"<<endl;
cout << " You choosen to stay in the cave"<<endl;
cout << "-------------------------------------------------------------"<<endl;
cout << " You camp out for a small amount of time. But you get a little"<<endl;
cout << "sleepy. When you close your eyes, a zombie eats and kills you instantly"<<endl;
cout << "-------------------------------------------------------------"<<endl;
cout << " GAME OVER"<<endl;
cout << "-------------------------------------------------------------"<<endl;
exit(0);
}
else if(userOp3 == 2){
cout << "-------------------------------------------------------------"<<endl;
cout << "You make a run for it to your dirt home"<<endl;
cout << "-------------------------------------------------------------"<<endl;
cout << " You run and you run and you get shot at with arrows by skeletons"<<endl;
cout << " But luckily an arrow just misses you when you close the opening of your home"<<endl;
}
else{
cout << "-------------------------------------------------------------"<<endl;
cout << "INVALID"<<endl;
cout << "-------------------------------------------------------------"<<endl;
}
}//second if--------------------------------------------------------------------------
else if(userOp2 == 2){
cout << "-------------------------------------------------------------"<<endl;
cout << "You decided to stay inside"<<endl;
cout << "-------------------------------------------------------------"<<endl;
}//second else------------------------------------------------------------------------
else{
cout << "-------------------------------------------------------------"<<endl;
cout << "INVALID" <<endl;
cout << "-------------------------------------------------------------"<<endl;
}
}//First if -----------------------------------new--------------------------------------------------
else if(userOp == 2){
cout << "-------------------------------------------------------------"<<endl;
cout << "You decided to go look for some resources " << endl;
cout << "-------------------------------------------------------------"<<endl;
cout << " You go to look for resources, but you hear scary noise, sadly"<<endl;
cout << "you force yourself to make a dirt home to stay in because you know you are"<<endl;
cout << "not ready for the danger"<<endl;
}//first else
else{
cout << "-------------------------------------------------------------"<<endl;
cout << "INVALID" << endl;
cout << "-------------------------------------------------------------"<<endl;
}
cout << ""<<endl;
cout << ""<<endl;
cout << ""<<endl;
cout << ""<<endl;
cout << ""<<endl;
cout << "---------------------------------------------------------------------------------"<<endl;
cout << " So your in your home and it is about noon, and you know it is safe to go outside"<<endl;
cout << "---------------------------------------------------------------------------------"<<endl;
cout << " After a while the sun is up you can see all the plants, tree, terrain, and animals!"<<endl;
cout << "You collect some wood and kill some cows, chickens, and sheep."<<endl;;
cout << "Then, you come across this village"<<endl;
cout << "You ask around where am I, but you get no reply"<<endl;
cout << "Then you hear a man say 'Over hear'"<<endl;
cout << "The man says if you come with me I can help you."<<endl;
cout << " Pres 1 To not trust the man, Press 2 to trust him"<<endl;
cin >> userOp4;
if(userOp4 == 1){
cout << " You have decided, to not to trust the villager"<<endl;
}
else if(userOp4 == 2){
cout << "You have decided to trust the unfamiliar villiager"<<endl;
cout << "you followed the villager in a dark tunnel and your are stabbed to death."<<endl;
cout << "GAME OVER"<<endl;
exit(0);
}
cout << " So you decided to look around and see if anyone else would talk"<<endl;
cout << "when your about to leave a little boy come up to you"<<endl;
cout << "The little boy says, who are you?"<<endl;
cout << "you say"<<endl;
cout << "My name is ";
cin >> user;
cout << " The little boy says where are you from?"<<endl;
cout << "you say you are from"<<endl;
cin >> town;
cout << "Then the little boy says, yeah! No one talked to you because we though"<<endl;
cout << "you were from the nether"<<endl;
cout << " The the little boys says, to the villagers, he's not from the nether"<<endl;
cout << "then the villagers are not longer scared of you and speak to you."<<endl;
cout << " The villagers tell you how another man just like you lives in the southern part of the village"<<endl;
cout << " It is your friend who you lost!"<<endl;
cout << "he must of come upon the village when you were asleep"<<endl;
cout << "your friend has a good established home and offers if you like to stay with him"<<endl;
cout << " Again it looks really dark"<<endl;
cout << " Press 1 if you want to go home snd get your stuff or Press 2 to forget about your old belongings"<<endl;
cin >> userOp5;
if(userOp5==1){
cout << "When you walk a good distance to see your house, you are killed by a creepr sneaking up behind you"<<endl;
exit(0);
}
else if(userOp5==2){
cout << "You forget about your stuff and stay with your friend"<<endl;
}
cout << "Your friend tells you he have salvaged enough items to create a new plane and fly away" <<endl;
cout << " Do you want to leave the amazing unknown land you have come upon?"<<endl;
cout << " If you want to leave press 1, If you don't want to leave press 2"<<endl;
cin >> userOp6;
if(userOp6==1){
cout << " You leave and tell your friends all about your journey, have"<<endl;
exit(0);
}
else if(userOp6==2){
cout << "You stay with the villages and begin you life in a whole new world and you find out"<<endl;
cout << "The world is called MINECRAFT"<<endl;
exit(0);
}
}
int main(void){
cout << "---------------------------------------------------------------------------------"<<endl;
do{
cout << " Please enter password"<<endl;
cout << "-------------------------------------------------------------"<<endl;
cin >>userOp101;
cout << "---------------------------------------------------------------------------------"<<endl;
if(userOp101 != password){
cout<< " Incorrect Retry "<<endl;
}}while( userOp101 != password);
cout <<"What Would you like to do ?"<<endl;
cout <<" 1 for Calculator, 2 for SurvivalCraft"<<endl;
cin >> userOp200;
if(userOp200 == 1){
runCalculator();
}
else if(userOp200 == 2){
survivalcraft();
}
return 0;
}
can you tell me where to go from now?
yes i plan on mastering c++, so i can move into game programming, modeling, etc...
This post has been edited by macosxnerd101: 18 July 2012 - 09:07 AM
Reason for edit:: Fixed code tags

New Topic/Question
Reply




MultiQuote








|