C/C++ :: Rock Paper Scissors Console Game

May 14, 2014

I made a rock paper scissors game in c++. How to make it better, and what i can do differently

#include <iostream>
#include <string>
using namespace std;

int checkConvertInput(string signs[], int wins, int draws, int losses);
void calculateWinner(int playerSign, string signs[], int &wins, int &draws, int &losses);
void endResult(int wins, int draws, int losses);

[Code] .....

View 1 Replies


ADVERTISEMENT

C++ :: Rock Paper Scissors Game - How To Add Play Again Option

Apr 1, 2014

So , i had to make an rock paper scissors game . After lot of hard work and struggle ,I completed it but my professor rejected it since I didnot add option where it says "Would you like to play again .Y/N " . The code has too many brackets ! Here is my code

#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;

// for displaying the outputs to the user; passing string to functions
void user_win() {

[Code] ....

View 1 Replies View Related

C :: Rock Paper Scissors Program?

Oct 10, 2013

what im trying to do is an option to play again. if the user decides to play again then i want the options to execute again and if the user choses not to play again then i want the game to show the scores.

here is what i have so far:

Code:

// Purpose: Play the Rock-Paper-Scissors-Lizard-Spock Game
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

[Code]....

View 10 Replies View Related

C++ :: Initializing Loop And Returning Values Rock Paper Scissors

Dec 2, 2013

When i return 0; at the function int userselect (int user, int comp)my output displays twice and when i ask the user to run it again the computers selection of rock, paper or scissors remains the same it doesn't find a new random number. So i made the function userselect return to main(). This works and my output is displayed once, but when i run it it skips my while part of my do while loop completely so it loops the program without asking the user if they wish to run it again.

but when i return main() the computers choice re-randomizes every time so i need to find a way to get the while part of my do while to initialize and the program to not loop without the option of ending it.

#include <iostream>
#include <string>
#include <cmath>

[Code]....

View 1 Replies View Related

C/C++ :: Rock Paper Scissors - Displaying Output And Choosing Random Option?

Aug 11, 2014

today I've been working on a rock, paper and scissors game. It compiles OK, except:

It doesn't use a random number from 1 -3, or goes out of scope.2. It doesn't COUT and it doesn't flush the buffer.3.

My code is as follows:

#include <windows.h>
#include <iostream>
#include <cstdlib>
#include <ctime>
std::string randomPC(int &);
void PCSelect(int &);

[code]....

View 2 Replies View Related

C++ :: How To Make A Game Map In Console Using Text

Oct 25, 2014

How would I make a game map in the console using text? The map is to be changed on a turn-based system. I've been thinking about using arrays.

View 1 Replies View Related

C++ :: Creating 2 Dimensional Console Base Game

Jun 13, 2013

what i got so for my code.

#include <iostream>
#include <windows.h>
using namespace System;
using namespace std;
int refreshDisplay(int , int);
const char wHole = '@';

[code]....

count <<" The oblective of the game is for the player to move around a 2 dimensional playing field and capture the star withought falling into a black hole or walking off the edge of the playing field. The controls are W = up S= down A=Left D=Right" <<endl; how implement 3 black hole X characters and 2 wormhole characters on field @ and a star *. all these char has to be randomly generated.

View 1 Replies View Related

C++ :: How To Create Text Based Game Running On Console

Mar 12, 2013

I want to create a text-based game with C++, running on the console. I have made some other text-based console games.

Which is the most interesting text-based game to learn how to program for beginners?

View 2 Replies View Related

C++ :: Tic Tac Toe Console Game - If Statement Does Not Make Correct Decision

Feb 18, 2015

I recently wrote a "Tic Tac Toe" console game, and i seem to have a problem in my winning conditions, as when it checks if the player won (should have won) it doesn't take the appropriate action.

The winning conditions are in CoreLogic.cpp

here's the code, might not be the most pretty and clean code ever but it works for me.

there are more files i just didn't feel the need to include them all since the problem is only within CoreLogic.cpp and possibly in main.cpp

pos1-pos9 have been declared in the UserInterface.cpp and are being used to determine the correct decision to do within CoreLogic.cpp

Nothing happens when you win at this point it just exits the program.

View 19 Replies View Related

C/C++ :: Circle Paper Of Radius R - Max Cone Volume

Jan 23, 2014

My problem is the following : We have a circle paper of radius R. We will cut off a sector of this circle (with length rem_sec), and the remaining (bigger part) will create a cone. Radius of cone base is r.

I need to create a code that prompts the user to enter circle's radius R and the program will calculate the length of removed sector (rem_sec) so that the created cone has the Max Volume.

I wrote the following code, but it doesn't work. It displays both rem_sec and MaxV = 0.

#include <iostream>
#include <cmath>
#include <iomanip>
#include <conio.h>
using namespace std;
const double PI = 3.1415;
int main() {
double rem_sec;

[Code] ...

View 5 Replies View Related

C Sharp :: Setting Custom Paper Size Of Crystal Report?

Sep 20, 2014

I want to print a report half sheet in A4 size..

I tried to change paper size in coding and in properties also but no use..so what is the correct code to change as custom size of report.

View 1 Replies View Related

C++ :: Game Design Practice For Accessing Container Of Game Objects

Dec 21, 2014

I'm working on my first video game. So far I have a few classes in the game starting with the Game class which includes a list of GameObjects (another class). There are several classes that inherit from GameObjects used to implement things like bullets, explosions, various enemy types, etc.

The game essentially iterates through the list of GameObjects to update/render them. I would like to provide access to the Game's list of GameObjects inside another class (like the Bullet class) so I can put new objects on the list. For example, when a bullet hits, I want to add an explosion to the Game's GameObject list it can be updated/rendered.

How this should be setup? I was considering adding a pointer to the Game or GameObject list to the GameObject class (and methods to access it), but I was wondering if there is a better way to set this up?

View 4 Replies View Related

C++ :: Program For Calculating Total Price Of Game Station And Game

Sep 13, 2014

I would like to make a program for calculating the total price of a game station, and a game. I made a program like this for just the price of a game in class, but I want to make one that does the game system as well.

View 7 Replies View Related

C++ :: Open Other EXE New Console?

Oct 11, 2014

Main console: qwer.exe
Secondary console: asdf.exe

System(c:asdf.exe);

I wanna open this asdf.exe new console. Not in the qwer.exe.

View 1 Replies View Related

C# :: Console App Won't Close

Dec 22, 2014

Im having a problem with the below code within a console app, I am copying and pasting data across server locations, the copy works fine but it looks like the app wont close and I am left with the screen (Shown in attachment). I want to run this in part of a batch process but because the app stay open it wont move onto the next task.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace SQL_Backup_Move_Files {

[Code] ....

View 3 Replies View Related

C/C++ :: Console RPG SHA-256 Checksum

Jun 29, 2014

So I'm making a console rpg and after the task of making my save/load functions I began making a sha-256 checksum so the save file can't be edited. I've pretty much all of the code but when I save the game and the checksum of that save file with my save function, I go back to load it and it always goes to the statement that says the checksums do not match and when I check the chksum.dat the hash is the same every time, here is my code:

#include <iostream>
#include <conio.h>
#include <windows.h>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <cstdlib>
#include <windows.h>
#include <fstream>
#include "sha256.h"
using namespace std;
void MaximizeWindow() {

[Code] .....

View 3 Replies View Related

C++ :: How To Use Mouse In Win32 Console

Jan 28, 2014

I want to show and control mouse in Win32 Console. What should I do? And I want to learn MFC programing.

View 3 Replies View Related

C++ :: Adding UI To Console Application

Apr 6, 2013

Any tutorials on adding a UI to a console application? All I really need is a button that will run one function every time I click it.

View 1 Replies View Related

C++ :: Output To Console And Log File

Apr 4, 2013

I have 18,000 lines of code that i would like to upgrade to include a log file. I want to replace the cout with a stream or something similar so that i can easily output to the console and to a log file at the same time with minimal change to 18,000 lines of code. I'm nearly there.

I used this post heavily as a reference; [URL] .... however it is highly incomplete and this is above my knowledge so I'm struggling somewhat.

I was able to get the bulk of it working with some guess work and modification to the code from that link.

For some reason i had to comment out "mstream(void);" and "~mstream(void);"

Also how to get :

mstream& operator<< (ostream& (*pfun)(ostream&)) {
pfun(coss);
pfun(cout);
return *this;
}

to work for endl as per the previous link. Not sure if i'm even putting it in the right place. Otherwise the code works fine for streaming to both locations and such. See the code below;

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class mstream {

[Code] ....

View 9 Replies View Related

C++ :: Console App - Outfile Results

Aug 5, 2013

I have created a game that functions correctly, however, for balancing and future changes, I would like to record results .txt document (its 1v1 btw). I already have code to determine who won and what I am looking for is some way to keep track of different match-ups for the different characters. Im looking for something like this:

loser
Winner char1 char2 char3
char1 3 2 5
char2 2 5 4
char3 8 1 2

the numbers are the amounts of wins a given character has over another character. I'm looking for code to open the .txt file and add 1 to the respective win total so I can do balance changes and such.

View 1 Replies View Related

C++ :: Console Applications Keep Crashing

Jan 11, 2013

Any time I run my program after I make a selection from the menu the output is printed on the console screen then immediately a windows screen comes up saying project.exe has stopped working.

Below is my code, and I suspect the error has something to either

A) due with how I'm calling the method or
B) how I have the method coded.

Main
#include <iostream>
#include <fstream>
#include <string>
#include "telephone.h"
#include "tbook.h"

[Code] .....

View 4 Replies View Related

C++ :: How To Stop Console From Pausing

Mar 6, 2014

Just a quick newbie question: I'm doing a console application and whenever I open a .exe using system(), the console pauses and does not run the next instruction until I close this exe. For example when I do this:

...
system("mspaint.exe");
printf("Hello");

It opens ms paint and does not print the next message until Paint is closed. How do I work around this?

View 1 Replies View Related

C++ :: How To Hide Console Or Terminal

Jul 2, 2013

I want to hide a terminal appliction or console application without using WinAPI programming or <windows.h> or something like "ShowWindow(hwnd_win,SW_HIDE);

View 19 Replies View Related

C++ :: How To Stop Displaying The Console

Mar 6, 2013

I am trying to display a messagebox, but instead of just displaying the message box, there is also a console the pops up. How do I prevent the console from popping up? I'm using Visual Studio 2012. I'm creating an empty project, but I still get the console.

View 1 Replies View Related

C++ :: Open More Than One Console In One Program

Oct 22, 2014

I am creating a console based application which needs to be dual tasking, which prompts me to share a single console for the GUI console based and inputs from the user.

I want to know if there is a mechanism through I can open more than one command prompt so that I would use efficiently both of them.

Furthermore, I would need also to know how to control on which to print and on which not to be printed.

Is there such a thing?

I am using Visual Studio 2012 Ultimate on a Windows 8.1 Professional PC.

View 1 Replies View Related

C++ :: How To Have Console Recognize Every Word

Apr 6, 2013

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

int x;
string favword;

[Code] ....

I want this program to be able to recognize if a user types in any word ex. (apple, tree, house etc..) and print "system error" if a word is recognized not to be a number. The bold section of code is my failed attempt to try this. Basically I need to know what to make

(x = ?(every word)) in order to finish my console program.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved