• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Bernie8a

My first Program

5 posts in this topic

This is my first program i have made, i made this program to practice what i have learned the past weeks,

let me now how it is and if you need to see code tell me for improvements.





[code] #include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main()

{
cout << "ON THIS PROGRAM YOU WILL HAVE THE CHOICES ON WHAT TO DO " << endl << endl << endl;

cout << "Your walking on a rainy dark night, suddenly a lightning flashes and you" << endl;
cout << "see a castle roof inside the forest." << endl << endl;

cout << "Press 1 to go inside the forest. " << endl;
cout << "Press 2 to keep walking home. " << endl;

int choice;
cin >> choice;

switch(choice)
{
case 1:
cout << " you have enter the dark woods of chaos, you now find yourself, " << endl;
cout << " lost inside the forest, you then start walking to the castles door" << endl;
cout << " you find a group of people gathering infront of the castle door, " << endl;
cout << " there yelling that there going to find the source that is keeping " << endl;
cout << " them trap in the dark forest." << endl << endl;



cout << "Press 3 to enter the castle for shelter. " << endl;
cout << "Press 4 to Grab weapons and join the fight. " << endl;

break;
case 2:
cout << " You got home and went to bed thinking what would of " << endl;
cout << " happened if you went to the castle. " << endl;

cout << " <--------------GAME OVER--------------> " << endl;

cin.get();
cin.ignore();
return 0;
}



cin >> choice;

switch(choice)
{
case 3:

cout << " The door is locked, solve the math problem to enter the castle" << endl;
cout << " 5(x - 3) = 35 " << "enter right answear for x to open door." << endl;

break;

case 4:

cout << "you grab a weapon and join the people that were going to war" << endl;
cout << "you walk north into the forest and you find two paths, " << endl;
cout << "but one is blocked with a big giant stone, you go to the path " << endl;
cout << "that is not blocked, sadly there was a giant hole on the way" << endl;
cout << "you go back to the castle " << endl;

cout << " The door is locked, solve the math problem to enter the castle" << endl;
cout << " 5(x - 3) = 35 " << "enter right answear for x to open door." << endl;

break;
}


int x;
cin >> x;

if ( x == 10 )
{

cout << "answear is correct, proceed" << endl << endl;
}

else if ( x != 10 )
{

cout << " Bad answear, the door shots a curse into you " << endl;
cout << " <----------GAME OVER--------------->" << endl;
cin.get();
cin.ignore();
system ("PAUSE");
return 0;
}


cout << " you search the castle, and notice that it's empty, but you see a " << endl;
cout << " nice chest that you aproach." << endl << endl;

cout << "!!!!chest talks to you and asks you a question!!!!!" << endl << endl;
cout << "??????_How many types of flow controll are there_??????" << endl << endl;

int answear;
cin >> answear;

if ( answear == 3 )
{
cout << " chest opens and you find a TNT inside it. " << endl << endl;
cout << " You grab the TNT and go back outside. " << endl << endl;
}

else if ( answear != 3 )
{
cout << " Wrong answear, the door closes you are trap inside forever " << endl;
cout << " <---------------GAME OVER-------------> " << endl;

cin.get();
cin.ignore();
system ("PAUSE");
return 0;
}

cout << "you find no other choice but to grab a weapon and join the fight" << endl << endl;
cout << "you walk north into the forest and you find two paths, " << endl;
cout << "but one is blocked with a big stone, luckily you" << endl;
cout << " have a TNT and you can choice were to go. " << endl << endl;

cout << " 5: Plant TNT destroy stone to go that way. " << endl;
cout << " 6: Follow the path that is open. " << endl << endl;


cin >> choice;

switch (choice)
{

case 5:
cout << " Solve problem to activate TNT for 10 seconds " << endl;
cout << " 5(4x - 3) + 8 = -2 " << endl << endl;
break;

case 6:
cout << "you go to the path that is not blocked, sadly there was a giant hole on the way" << endl;
cout << "you go back to place the TNT on the stone. " << endl << endl;

cout << " Solve problem to activate TNT for 10 seconds " << endl;
cout << " 5(4x - 3) + 8 = -2 " << endl << endl;
break;
}


double a;
cin >> a;


if ( a == 0.25 )
{

cout << " TNT ACTIVATED----------< " << endl;
cout << "10, 9, 8, 7, 6, 5, 4, 3, 2, 1 BOOM!" << endl;
}

else if ( a != 0.25 )
{
cout << " TNT explodes immediately " << endl;
cout << "<--------GAME OVER-------->" << endl;

cin.get();
cin.ignore();
system ("PAUSE");
return 0;
}

cout << "Path is open, when you enter you find out that it's a " << endl;
cout << "demons lair, you are now fighting with a demon. " << endl << endl;

cout << "Solve the problems to attack demon" << endl<< endl;

cout << " 243 * 28 = n " << endl;


cin >> x;

if ( x == 6804 )
{




int d;
d = 150 - 50;

cout << "Your life: " << 50 << endl << "Demons life: " << 150 << endl << endl;
cout << "You attack the demon" << endl << endl;
cout << "Your life: " << 50 << endl << "Demons life: " << d << endl;
}

else if ( x != 6804 )
{
cout << "Demon kills you " << endl;
cout << "<--------GAME OVER-------->" << endl;

cin.get();
cin.ignore();
return 0;
}



cout << " 5 * 4(23) / 3 = x" << endl;


cin >> x;

if ( x == 705 )
{


int d;
d = 100 - 50;

cout << "Your life: " << 50 << endl << "Demons life: " << 100 << endl<< endl;
cout << "You attack the demon" << endl << endl;
cout << "Your life: " << 50 << endl << "Demons life: " << d << endl << endl;
}

else if ( x != 705 )
{
cout << "Demon kills you " << endl;
cout << "<--------GAME OVER-------->" << endl;

cin.get();
cin.ignore();
return 0;
}

cout << " whats the average of 23 + 52 +12: " << endl;



cin >> x;

if ( x == 29 )
{
int d;
d = 50 - 50;

cout << "Your life: " << 50 << endl << "Demons life: " << 50 << endl<< endl;
cout << "You attack the demon" << endl << endl;
cout << "Your life: " << 50 << endl << "Demons life: " << d << endl << endl;
}

else if ( x != 29 )
{

cout << "Demon kills you " << endl;
cout << "<--------GAME OVER-------->" << endl;

cin.get();
cin.ignore();
return 0;
}

cout << "You have killed the demon that was cursing the forest now your able to" << endl;
cout << "exit the dark forest " << endl;


cout << "You went back home happy to be alive :D" << endl << endl;


cout << " CEDITS " << endl;
cout << " Programer: Bernie Ochoa " << endl;
cout << " Story: Bernie Ochoa " << endl;
cout << " Company: Core-Bros " << endl;
cout << " http://corebros.webs.com/ " << endl;
cout << "<------THANKS FOR PLAYING-----> " << endl;





cin.get();
cin.ignore();
return 0;
}





[/code]









also how do i post my work in my profile? this question was answeared thanks :D.
0

Share this post


Link to post
Share on other sites
Currently you have not posted anything. Edit your post and click the < > button to give you code tags and paste between those. That, or the code formatting is being sorted right now.
Either that, or you're expecting us to rate the code without actually giving us code.
And to post work into your profile you need to become a GD.NET+ member. It costs money for the subscription, but you get a dev journal and space on here for projects and support the site. If you've only just written your first project, it may be a little much (unless you want to support the site).;)
1

Share this post


Link to post
Share on other sites
Please don't use polls in this forum.

[quote]
[color=#1C2837][size=2]And to post work into your profile you need to become a GD.NET+ member. It costs money for the subscription, but you get a dev journal and space on here for projects and support the site. If you've only just written your first project, it may be a little much (unless you want to support the site).;)
[/quote]
You don't need a GDNet+ membership for journals, they are freely available to all users now. You also don't get storage space any longer, period. So the OP can just create a journal and post his projects in there if he/she likes.[/size][/color]
0

Share this post


Link to post
Share on other sites
[quote name='The Communist Duck' timestamp='1295627228' post='4762490']
Currently you have not posted anything. Edit your post and click the < > button to give you code tags and paste between those. That, or the code formatting is being sorted right now.
Either that, or you're expecting us to rate the code without actually giving us code.
And to post work into your profile you need to become a GD.NET+ member. It costs money for the subscription, but you get a dev journal and space on here for projects and support the site. If you've only just written your first project, it may be a little much (unless you want to support the site).;)
[/quote]






Alright thanks for your help i posted the code now, let me now how it is. :)


0

Share this post


Link to post
Share on other sites
I believe your math is incorrect. Where it says 5(x - 3) = 35, x does not equal 4. It equals 10:

5(x - 3) = 35
x - 3 = 7 (divide by 5)
x = 10 (add 3 to both sides)

A thing I can speak of is:
- You do not have to declare a separate variable for every new input you get. You can reuse the previously initialized variables.

For example: For every choice branch you create a new choice variable, but instead, you could keep the original one that you are no longer using. Same with the math equations. Once you check if the answer is correct and no longer need the variable, you can overwrite the value it stores with something else.

Other than that, I think it's pretty good.
1

Share this post


Link to post
Share on other sites
[quote name='boogyman19946' timestamp='1295635568' post='4762558']
I believe your math is incorrect. Where it says 5(x - 3) = 35, x does not equal 4. It equals 10:

5(x - 3) = 35
x - 3 = 7 (divide by 5)
x = 10 (add 3 to both sides)

A thing I can speak of is:
- You do not have to declare a separate variable for every new input you get. You can reuse the previously initialized variables.

For example: For every choice branch you create a new choice variable, but instead, you could keep the original one that you are no longer using. Same with the math equations. Once you check if the answer is correct and no longer need the variable, you can overwrite the value it stores with something else.

Other than that, I think it's pretty good.
[/quote]







Nice bro i didn't know that, thanks for the info and the math check, i already adjust and fix the code so it will be at its best, let me know if the code is at its best now. :)


0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0