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


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/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 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++ :: Choosing Random Item From Array?

Apr 27, 2015

I need to finish this program which has to ask for seed, then the user gives 5 friends, and then it will choose who to text randomly and show who did not make the cut.

This all i have, I am stuck and I do not know if it correct.

#include <iostream>
#include <string>
using namespace std;
int main() {
string num_friends[5];
int user_input;

[code]....

View 7 Replies View Related

C++ :: Guess Number Game - Choosing Integer At Random

Jun 11, 2013

Write a program that plays the game of guess the number.the program chooses the number to be guessed by choosing an integer at random in the range 1-1000. The program then types 'i have a number between 1 and 1000,can you guess number? Then the player then types the first guess, the program responds.

View 1 Replies View Related

C# :: Random Select Dictionary Values Not Displaying

Apr 10, 2014

I am having trouble getting values of a dictionary to display in a label and radio button text after the dictionary key is randomly selected.

I first created a class called TheoryQuestions and created a new instance of the class for each dictionary entry. Each entry contains strings for Question, RadioButton Text(x4), and Correct Answer.

The random generator is actually selecting a random number as I can display the generated number in a label. The problem is that the dictionary string values held in the dictionary position represented by the random number are not being displayed.

Here is my TheoryQuestion Class

public class TheoryQuestion {
bool BeenAsked = false;
public string Question
{
get;
set;
}

[Code] .....

Its probably some mistake I have made but I just can't see it.

View 4 Replies View Related

C/C++ :: Output Displaying As 0?

Mar 5, 2015

I am trying to write a c program to convert centimeters to inches and then to feet. I have most of the code written but not sure how to debug it. I keep getting "0" as all of my output.

#include <stdio.h>
// Main Function
int main(void)

[Code]....

View 2 Replies View Related

C++ :: Output Displaying Out Of The Screen

Feb 11, 2014

I have turbo c++ on windows xp SP2.....whenever i compile my code in turbo c++ i am getting output outside the screen.....but when i used code::block....i get the correct output...fits to screen ...

View 7 Replies View Related

C/C++ :: Basic 2D Array Displaying Output?

Feb 23, 2014

I been for trying to create 5x5 2d array that

basically display first column, last column , and diagonally (like " N " display). but i cant get it to work.
this is what i have so far.

int _tmain(int argc, _TCHAR* argv[]) {
char Test[5][5];
for (int i = 0; i < 5; i++)

[Code]....

View 4 Replies View Related

C++ :: Displaying Correct Output By Using For Loop (with Pointers)

Feb 4, 2014

I wanted to display the correct output by using a for loop at the end of my code, but for some reason it's not working correctly.

#include <iostream>
using namespace std;
int main() {
int* ipArray[3];
for(int i = 0; i < 3; i++) {
ipArray[i] = new int [5];

[Code] .....

What I wanted to do is pretty much match my 1st out put like 0 1 2 3 4 but my 2nd output only outputs 24's and I don't know why

View 11 Replies View Related

C :: Not Getting Actual Output While Displaying Hex Numbers In Decimal Format

Apr 26, 2013

I need to display 0-15 hex numbers[0X00-0x0F] in decimal value...& I'm getting the output but it's not exactly what it should be,below is my code.. [This not the complete code,but main part where the changes are done]

Actual output i should get is for 1v it should generate 0001,for 2v it should generate 0010 and simultaneously till [15v-1111]... But what i'm getting is exactly different to this for eg for 7v,8v&9v the bits generated are 1101,1011,1011 respectively...

[URL] ....

Code:
sbit V1 = P2^0;
sbit V2 = P2^2;
sbit V3 = P2^4;
sbit V4 = P2^6;
#define DAC_table V1,V2,V3,V4

#include <stdio.h>
#include <string.h>
idata unsigned int ptr2tbl ;

[Code] .....

View 2 Replies View Related

Visual C++ :: Read Some Text And Output Without Displaying Repeating Words

Sep 8, 2014

I have been given an assignment to make a code to read some text nd display all the words nd the number of times they appear in another file or as output without displaying the repeating words. I made the code but its not giving any output.

#include<iostream>
#include<conio.h>
#include<fstream>
#include<string>
using namespace std;
void read(string);
string x,z,w;

[Code] ....

View 3 Replies View Related

C :: Output Calculation (random Numbers)

Mar 24, 2014

Why do i keep getting wrong results

Code:
#include "stdafx.h"#include <stdio.h>
#include <string.h>
nt main(void){
char name[40];
int numbers[50];

[Code] .....

View 4 Replies View Related

C++ :: Assigning Input To Value - Random Output

Jul 24, 2014

I'm using getline, and stringstream to assign an input to a value. How to do something similar with a random output.

//Battle with Samer
#include <iostream>
#include <string>
#include <sstream>
#include <ctime>
#include <cstdlib>
using namespace std;

const char* PokemonSamer[6] = {
"Charizard", "Umbreon", "Mew", "Arcanine", "Espurr", "Luxaray"

[Code] ....

When I run <PokemonSamer[rand() % 6]>, I want to be able to save whatever that output may be, and save it to <string Samer>. Is this possible?

View 6 Replies View Related

Visual C++ :: Output Of Random Numbers

Apr 6, 2015

I wrote an code for generating an aoutpu of random numbers, but it doesn't gives me back the numbers here is the code:

#include <iostream>
#include <time.h>
#include <cstdlib>
#include <stdio.h>
#include <iomanip>
#include <cmath>
using namespace std;
const int ANZ = 6;

[Code] .....

I cant find the mistake.

View 2 Replies View Related

C++ :: Choosing Input Streams

May 23, 2013

So I built an interpreter for a language I made, but I can't get the streams right. I have an istream pointer and if they don't supply a cmd line arg, it references the adress of cin, which works fine. however, if they do supply a file in the form of cmd line args, i want to make it reference an ifstream. how do i do that?

View 1 Replies View Related

C++ :: Choosing A Number Between Limits?

Oct 9, 2013

Im trying to choose a # between 1 and 1000 (can be 1 or 1000), error check it, but keep asking until I get the correct input.

#include<iostream>
using namespace std;
int main () {
int num;
bool goodNum;
goodNum = false;
while (!goodNum)

[code]....

This program analyzes a number, determining whether a number is prime or not, perfect or not, and output a list of all divisors for non-prime and perfect numbers.

Enter a number between 1 and 1000 then hit enter: 9000

You entered 9000.

Press any key to continue . . .

View 2 Replies View Related

C++ :: Output Sections Of Txt Code In Random Order

Mar 27, 2014

I will keep this simple as I have the code written for my testing software program, I just want to add a feature of randomly generating the answer choice output order, I do not want to randomly output the full questions, but instead the choices (answers to the question), for example =

#include <string>
#include <iostream>
#include <limits>
cout <<" " << endl ; \ space

[Code] ....

As you can see I would like to output the answers, choices randomly as in answer choice 3 will appear at the top instead of 1. and so on, it doesn't matter if the numbers move with the txt as the numbers beside the
questions are txt.

It's a 32bit console application.

View 4 Replies View Related

C :: Picking And Choosing Between User Inputs

Jul 31, 2013

I have recently looked into a self created project where I wanted to compare user input against a list of strings in an external file. That has since been completed to my great satisfaction, however it did throw up some interesting issues in my knowledge and understanding of user input..What is the best way to pick up user input i.e scanf,stdin etc. and when should either be used and can a mixture of types be used, and if so, when and why.

A quick program to take different input methods and display differnt output method (obviously corresponding i.e scanf/printf - fgets/fputs)

My first pothole came when I have setup the method for scanf - fine. Then I setup the method for fgets(test,100,stdin) for example and the fgets method no longer picks up stdin from the user..

View 3 Replies View Related

C++ :: Constructing Random Text Generator - Final Output

Nov 26, 2013

I am constructing a random text generator and i am almost done i just need final output. Here is my coding

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

const int NUM_FRIENDS = 5;

[Code] ....

This is how the output is supposed to look like

Program Output

== Who Should I Text? ==
Enter seed
Enter friend 0
Enter friend 1
Enter friend 2
Enter friend 3
Enter friend 4
You should text: Cat

These other friends didn't make the cut:
Adam
Bill
Damion
Edward

I can't figure how to output the remaining names.

View 3 Replies View Related

C++ :: Merge Sort Algorithm - Output Random Results

Sep 16, 2012

I am trying to code a merge sort algoritm, using my knowledge of C++. I have made some code but it is not working. It is giving some random results.

Code:

#include <cstdlib>
#include <iostream>
using namespace std;
void print(int *niz) {

[Code] ....

View 1 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++ :: How To Add A Select Option

May 27, 2013

I just started on a project on c++ and I was wondering if it is possible to add a select option (where the c++ program requires the user to select an option) . I couldn't find this anywhere.

View 3 Replies View Related







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