C++ :: How To Store A Score
Mar 28, 2013
I want to do something like when you have completed the first question then the program will give you +3 in coins then you have completed next question then I want the program to add 3 more so it says you have a value of coins 6. But I do not know exactly how to do this the code I begun to write was this:
Code:
#include <iostream>
using namespace std;
int main()
[Code] ...
This code works for 1 question but I want it to work like add 3 for every question the user guesses correct. Like if user enters the correct answer 3 times then he/she has a value of coins 9.
View 2 Replies
ADVERTISEMENT
Aug 27, 2014
#include <stdio.h>
float total, avg, max, min;
float judge[4];
int index;
int array[4];
int main() {
total = 0.0;
max = array[0];
min = array[0];
[Code] ....
I dont understand how to make the array when it prints out only print out the final average and the final maximum score with the final minimum score but what its doing at the moment is just giving an average for each individual score taken...
Minimum and maximum scores are displaying 0.0
And it displays these things 4 times in a row i just want it to be displayed once.
View 1 Replies
View Related
May 18, 2014
Currently in development of a cookie clicker clone (for fun)
I am stuck at the idea of the "Cookies Per Second" thing.
Is there a way to implement a per second adder thing that doesnt actually effect the game play (eg even though the player may not be pressing C every second a cookie (or more) will be added, or if they can press C more than once a second, every second a cookie will be added... If you get what I mean).
Code is below if you would like to look />
MAIN.cpp
#include <iostream>
#include <conio.h>
#include <Windows.h>
#include "Shop.h"
#include "Varis mate.h"
[Code] .....
View 3 Replies
View Related
Nov 10, 2013
I have to get the average score for each student. And modify my avgmarks function and write the marks to a output txt file.
Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int bubble(int*,int);
void filewrite();
void avgmarks();
void fileprint();
void filesort();
void rollin();
[Code] .....
View 1 Replies
View Related
Nov 20, 2014
A buddy and I have been working together to try and create a blackjack game for a project we are doing, and while we have a couple of issues we are trying to get worked out, for some reason we are perplexed as to how we can keep score. Right now, it keeps score but it doesn't reset when it adds a card. So if you had 14 and you hit, and added 3; you would have 31 instead of 17.
// initialize players and hands
srand(static_cast<unsigned int>(time(0)));
GetPlayerInfo(players);
do {
int score = 0;
bool busted = (score > 21);
ShuffledDeck(deck);
[Code] .....
View 2 Replies
View Related
Mar 28, 2015
I've made a game and a dialogbox to show up asking to enter a nickname.
The problem is After entering the nickname, it won't show on the highscore list below (textbox)
Where can the problem be? Below is my code:
private void btnPlay_Click(object sender, EventArgs e) {
if (txtName.Text != "") {
Settings.Name = txtName.Text.ToString();
[Code] .....
View 5 Replies
View Related
Mar 24, 2010
I have to develop an application named smart client score board in c#
Main requirements for this application are that application should display the live scores, detailed score board, running commentary (in text), players and team profiles, statistics of matches, results and fixtures for cricket.
sort out websites which support rss feeds for full score card.
View 6 Replies
View Related
Jul 22, 2013
I have programmed a game where you guess a number (1-6) and if the number is equal to the random number then give the player score + 10. But if I have selected for example 4 players then if the game will give player 1 a score it gives player 2 a score instead? What can be causing this error?
Code:
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int cube;
int number[4];
[Code] .....
View 6 Replies
View Related
Mar 5, 2013
I am using the following code to print in SDL screen
SDL_GL_RenderText( timer, font, color, &position);
sprintf(timer," Time : %d",time);
to print in SDL screen(used with opengl) , i am doing project on C++, as "sprintf" is C style function , so i can't do like this , i am trying to use" ostringstream" , but i am not sure how to use it.
View 1 Replies
View Related
Dec 9, 2013
I'm writing a program to keep score of a game of bowling. Whenever I run the program, it comes up with the correct starting point, but whenever i type in the first number and click enter, the program stops running and it gives a return value of something similar to 3221225477. Here is my code. I think the problem might be that I'm not using pointers..? but I could be way off..I'm new to programming.
#include <stdio.h>
int main() {
int frame[10][3] = {{0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0,0}};
int frameOutcome[10], frameTotal[10], currentFrame = 0, totalScore = 0;
[Code] ....
View 1 Replies
View Related
Dec 10, 2013
int main() {
double x, avg, max=0.0, min=100.0,totalsat=0.0, totalunsat=0.0, totalout=0.0;
int invalid=0, outstanding=0, satisfactory=0, unsatisfactory=0, kount=0;
ifstream inFile;
inFile.open("grades.txt");
[Code] ....
When the program tries to open the text file it just scrolls "0 unsatisfactory score" forever. The text file has grades in it I'm trying to sort
63
75
121
72
72
78
67
-9
80 .....
View 1 Replies
View Related
Feb 9, 2015
The code runs but asks me for my score twice then just comes to an abrupt end with out giving me a letter grade.
#include <stdio.h>
int getScore(void);
char convertGrade(int numscore, char letterGrade);
void showGrade(int numscore, char letterGrade);
// Function to prompt for and read a numeric score
// Returns an integer score as read in using scanf
[Code] ....
View 12 Replies
View Related
Nov 25, 2013
I am trying to correlate the student's highest score with that student's ID. The old code is in blue and the new code is in green which includes a sort. The particular information in question is in red.
Ide1
Code:
#include <stdio.h>
int main(void) {
/*Set up two arrays to include up to 50 elements each.*/
int st_numval_id[50] = {0}, st_val_tstscr[50]= {0}, i = 0, j = 0, temp;
[Code] .....
Enter the student's id and test score:
/*After the following input, then enter 0 to end the input*/
Student ID Test Score Letter Grade
------------ ----------- --------------
1653 77 C
1945 72 C
1020 50 F
1955 92 A
1900 81 B
ABOVE AVERAGE STUDENTS
Ave Test Score Students Above Ave Number of: A's B's C's D's F's
----------- ---------- --------- --- --- --- --- ---
62.00 4 1 1 2 0 1
THE STUDENT WITH THE HIGHEST TEST SCORE
Student ID Test Score Letter Grade
--------- ---------- ------------
1900 0 F
Press any key to continue...
View 1 Replies
View Related
Aug 8, 2013
We are told to modify this code following the instructions given within the code. It is a tictactoe program.
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
// Create a structure that stores a player's name (up to 20 characters) and score (# of wins)
// Call the struct Player
void info(void) {
printf("
[Code] ....
I've ended up with the following code, but the part about the name of the datafile is giving errors upon running the program.
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
// Create a structure that stores a player's name (up to 20 characters) and score (# of wins)
// Call the struct Player
typedef struct {
[Code] ....
View 4 Replies
View Related
Sep 28, 2013
my text for the score and difficulty doesn't seem to work. They are both appearing twice and not updating. The score text worked fine until I inserted the difficulty text and I can't seem to find the problem. URL.....
#include "stdafx.h"
#include <iostream>
#include <sstream>
#include <SFML/Graphics.hpp>
int main()
{
sf::ContextSettings settings;
//settings.antialiasingLevel = 8;
[code]....
View 2 Replies
View Related
Dec 11, 2013
[URL] ....
This is my code, but how can I implement this?
View 1 Replies
View Related
Apr 2, 2014
This program is supposed to take integer score inputs from the keyboard into an array and use a sentinel of -999 to end the process.It should call a show() function which passes the array and displays the name and number of the integer for the output.
# include <iostream>
using namespace std;
int main() {
int score(double array1[], int numbers);
[code].....
I am getting an error in the for loop r<number which states "Error identifier "numbers" is undefined" and on my array1 "Error identifier "array1" us undefined" also in my for loop.
View 3 Replies
View Related
Apr 28, 2014
I need starting a do-while loop in my program that runs up to 10 time that asks the user to enter up to 10 scores, which include the slope and rating for the course, and calculates the handicap for each score. Here's what I have so far:
//This program calculates a golfers handicap.
#include <iostream>
#include <string>
using namespace std;
int main() {
int score, slope;
double rating, handicap;
[Code] ....
View 1 Replies
View Related
Oct 9, 2014
Create a 1-D Array to hold a set of exam scores:
55 74 93 84 64 72 69 78 87 84 72 33 83 68 62 51 88 90
Write a program to do the following tasks:
1. Display scores in rows of four(4) scores.
2. Calculate average score and display.
3. Find Lowest score and display.
4. Find Highest score and display.
5. Find the deviation of each score, and display the score and its deviation.
6. Find the Standard Deviation and Display
7. How many scores are within One Standard Deviation
So I have the average down, but I am getting stuck at the part of displaying the highest and lowest score. Every time I run the program I get two giant negative numbers for both of them. I put all the scores into a .txt file and I just opened in through the program.
#include "TCHAR.h"
#include <iostream>
#include <fstream>
#include <iomanip>
[Code]....
View 1 Replies
View Related
Jul 24, 2014
I can display the highest and lowest score but I can't display the number of students who got the highest and lowest score.
int h=array[1];
int l=array[0];
int m=0,n=0;
for(int z=1; z<=20; z++) {
if(array[z]>h) {
h=array[z];
[code]....
this should be the output
12 students got the highest score of 45
8 students got the lowest score of 1
View 2 Replies
View Related
Oct 29, 2014
I need to get Students to input there Name And Score > and for me to output the grade. This works but I want to tidy this up so I can see all the names and grades when the program finishes.
#include "stdafx.h"
#include "stdafx.h"
#include <conio.h>
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
[Code] ....
View 9 Replies
View Related
Nov 11, 2014
I'm working on coding a game of pong that allows players to play until one reaches a score of 10. Once the winning score is reached I want to display a "Game Over" message stating which player won. The game works perfectly except for stopping when the winning score is reached.
Here is the code I have so far:
//pongTest.cpp
#include "stdafx.h"
#include <string>
#include <Windows.h>
#include <iostream>
#include <conio.h>
#include <sstream>
#include <math.h>
#include <glgl.h>
#include <glglu.h>
#include "GL/freeglut.h"
[Code] ....
Not sure if my gameOver() function just isn't written properly, I'm not calling it properly, or a mixture of both.
View 2 Replies
View Related
Apr 28, 2014
I need starting a do-while loop in my program that runs up to 10 time that asks the user to enter up to 10 scores, which include the slope and rating for the course, and calculates the handicap for each score. Here's what I have so far:
//This program calculates a golfers handicap.
#include <iostream>
#include <string>
using namespace std;
int main(){
int score, slope;
double rating, handicap;
[Code] ....
View 4 Replies
View Related
Mar 26, 2014
I am trying to bend my head around polymorphism but I can't figure out how to use the virtual method properly. I have the following superclass:
Code: class comparable
{
public:
comparable();
virtual bool compare(comparable &other)=0;
}; and the subclass:
Code: class score : public comparable
{
public:
score(string player,int highscore);
bool compare(comparable &other);
string name;
int highscore;
};
My problem is that I do not know how to define the virtual function compare in the subclass score:
Code: bool score::compare(comparable &other){
if(this->highscore > other.???){
...
}
}
How do I tell the compiler that the type is of score?
View 7 Replies
View Related
Mar 21, 2014
Write a function that computes and returns the score for a permutation, i.e. the number of reversals required to make arr[0] == 1.
HAVE TO USE FOLLOWING FORMAT:
Code:
// POST: Returns the number of reversals needed to make arr[0] == 1
// if the reversal game were played on arr
// Note: If arr[0] == 1 initially, then score(arr, n) returns 0 AND this is what i could muster;
[code]....
View 2 Replies
View Related
Apr 16, 2014
We're writing a program in class using data structures and arrays and I'm stuck on writing a loop to find the students' highest test score. I only return the first student's ID, test score, and grade. For some reason unknown to me I'm not actually looping through all 12 or so records.
Code:
#include <stdio.h>
#define MAX_ENTRIES 50
struct records
{ //declare my student records structure
int ID; //the student's ID number
int test_score; //the student's test score
char grade; //the student's letter grade of aforementioned test score
};
[code]....
View 5 Replies
View Related