It's a console application and I used code::blocks
I've some problem to fix switches in my code
Here is my code:
//-------------------------------------------------------------------------------------------------------
/*Name: WOP alpha 0.3
Copyright: W.O.P LTD All Rights Reserved
Author: Tommie Larsson
Date: 08-05-17
Description: Alpha 0.3 of the game/console/OS W.O.P.
*/
//-------------------------------------------------------------------------------------------------------
#include <iostream>
#include <string>
#include <windows.h>
#include <time.h>
#include <fstream>
//-------------------------------------------------------------------------------------------------------
using namespace std;
//-------------------------------------------------------------------------------------------------------
int main() // Open the program
{
//-------------------------------------------------------------------------------------------------------
int nInput(0);
printf("What would you like to do?\n\n"); // Prints a text
printf("1. Start W.O.P.\n"); // Prints a text
printf("2. Exit\n\n"); // Prints a text
printf("Choice: "); // Prints a text
cin >> nInput;
if (nInput >= 1 && nInput <= 3) {
if (nInput == 1) {
//-------------------------------------------------------------------------------------------------------
int nInput(0);
cout << endl;
cout << endl;
printf("\t 888 888 888 888888888 8888888888 "); // Prints a text
printf("\t 88 88 88 88 88 88 88 88 "); // Prints a text
printf("\t 88 88 88 88 88 88 88 88 "); // Prints a text
printf("\t 88 88 88 88 88 88 8888888888 "); // Prints a text
printf("\t 88 88 88 88 88 88 88 "); // Prints a text
printf("\t 888 888 888888888 8888 "); // Prints a text
cout << endl;
cout << endl;
cout << "Welcome to WOP" << endl; // Prints a text
printf("\n"); // Creates a blankspace
printf("1. New Game\n"); // Prints a text
printf("2. Load Game\n"); // Prints a text
printf("3. Options\n"); // Prints a text
printf("4. Credits"); // Prints a text
printf("\n"); // Creates a blankspace
printf("5. Exit\n"); // Prints a text
printf("\n"); // Creates a blankspace
printf("Choice: "); // Prints a text
cin >> nInput;
if (nInput >= 1 && nInput <= 3) {
if (nInput == 1) {
//-------------------------------------------------------------------------------------------------------
cout << endl; // Creates a blankspace
cout << endl; // Creates a blankspace
cout << endl; // Creates a blankspace
cout << " .---. .-----------" << endl; // Prints a text
cout << " / \ __ / ------" << endl; // Prints a text
cout << " / / \( )/ -----" << endl; // Prints a text
cout << " ////// ' V ` ---" << endl; // Prints a text
cout << " //// / // : : ---" << endl; // Prints a text
cout << " // / / /` '--" << endl; // Prints a text
cout << " // //..\\" << endl; // Prints a text
cout << "=============UU====UU====" << endl; // Prints a text
cout << " '//||\\`" << endl; // Prints a text
cout << " ''`` " << endl; // Prints a text
//-------------------------------------------------------------------------------------------------------
cout << "\tWOP requesting login\n";
int security = 0;
char again = 'y';
string username;
cout << "\nUsername: ";
cin >> username;
string password;
cout << "Password: ";
cin >> password;
if ((username == "Gamepower") && (password == "j6wfmdd5"))
{
cout << endl; // Creates a blankspace
cout << endl; // Creates a blankspace
cout << "\tWelcome Gamepower to WOP.";
security = 5;
}
if ((username == "quest") && (password == "guest"))
{
cout << endl; // Creates a blankspace
cout << endl; // Creates a blankspace
cout << "\tWelcome guest.";
security = 1;
}
if (0==security)
cout << "\tYour login failed.";
else {
while (again == 'y')
{
//-------------------------------------------------------------------------------------------------------
cout << endl; // Creates a blankspace
cout << endl; // Creates a blankspace
cout << endl; // Creates a blankspace
cout << "Please choose difficulty level:" << endl; //Prints a text
cout << endl; // Creates a blankspace
cout << endl; // Creates a blankspace
cout << "Difficulty Levels\n\n";
cout << "1 - Easy\n";
cout << "2 - Normal\n";
cout << "3 - Hard\n\n";
int choice;
cout << "Choice: ";
cin >> choice;
if (choice==1) {
cout << endl;
cout << "For beginners!\n";
cout << endl; // Creates a blankspace
}
{
if(choice==2) {
cout << endl; // Creates a blankspace
cout << "It's always normal!\n";
cout << endl; // Creates a blankspace
}
if (choice==3) {
cout << endl; // Creates a blankspace
cout << "Good luck!\n";
cout << endl; // Creates a blankspace
}
//-------------------------------------------------------------------------------------------------------
cout << endl; // Creates a blankspace
cout << "This game/console/OS is just an alpha so they game/console/OS" << endl; // Prints a text
cout << "isn't done yet." << endl; // Prints a text
cout << "That's why we must skip this part because it isn't ready to be tested." << endl; // Prints a text
cout << "Lets skip this part to the part when you just lost." << endl; // Prints a text
cout << endl; // Creates a blankspace
cout << endl; // Creates a blankspace
cout << "\tGameover! " << endl; // Prints a text
cout << endl; // Creates a blankspace
//-------------------------------------------------------------------------------------------------------
cout << "\nDo you want to play again? (y/n): ";
cin >> again;
}
cout << endl; // Creates a blankspace
cout << "\nOkay, logging out!";
}
if (0==security) {
cout << endl; // Creates a blankspace
cout << " Exiting because of incorrect login." << endl; // Prints a text
}
//-------------------------------------------------------------------------------------------------------
{
if (nInput == 2)
cout << endl; // Creates a blankspace
return 0; // Ends the program
}
}
if (nInput == 3) {
cout << endl; // Creates a blankspace
return 0; // Ends the program
}
}
if (nInput == 4) {
cout << endl; // Creates a blankspace
return 0; // Ends the program
}
}
if (nInput == 5) {
cout << endl; // Creates a blankspace
return 0; // Ends the program
}
//-------------------------------------------------------------------------------------------------------
{
if (nInput == 2) {
cout << endl; // Creates a blankspace
return 0; // Ends the program
}
}
return 0; // Ends the program
}
}
else {
return 0; // Ends the program
}
//-------------------------------------------------------------------------------------------------------
return 0; // Ends the program
}
//-------------------------------------------------------------------------------------------------------
And if Gabehabe looks at this I've a comment to you:
I'm not lazy, I'm just going to see if someone want to fix my code if not, I'm going to fix it by my self

New Topic/Question
Reply





MultiQuote











|