I have a problem on my program. I want to display the scores on notepad. I can display it but the problem is every time I play the game the previous score got erased and replaced by the new one.Here's my code.
cout<<" Enter your name: ";
cin>>a;
cout<<endl<<endl;
cout<<" Your name is "<<a<<" and your score is "<<right<<endl<<endl;
ofstream MyFile ("score.txt");
MyFile << a <<" "<<right;
MyFile.close ();
I need VC++ code,for copy the particular data from Notepad to another Notepad. Example, i have lots of data, i need to copy the particular content from Notepad to another Note pad.
Notepad 1:
<Debug: LogRLZ> arg Answer = windows //WINDOWS option will go to excel sheet <Debug: LogRLZ> arg Answer = patio_doors //patio_doors option will go to excel sheet <Debug: LogRLZ> arg Answer = entry_doors //entry_doors option will go to excel sheet
I am writing a class that dynamically allocates an array that holds a user-defined number of test scores (test scores go from 0 to 10 both included). Once all the test scores are entered and validated (values only between 0 and 10, both included), the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates theaverage of all the scores.The main program should display the sorted list of scores and the average of the scores with appropriate headings.
so in declaring a display function prototype only that displays a student test scores in the format (student name tab number of scores tab test scores )
is this right?
#ifndef STUDENTTESTSCORES_H #define STUDENTTESTSCORES_H #include <string> using namespace std; class StudentTestScores{ private:
[Code]...
and also how do we call the display function if it is in a class from the header file onto the main cpp file.
Okay so suppose that a text file grade.txt contains an unspecified number of scores. How would I program that reads the scores from the file and displays all the scores, their total and average? Scores are stored in the format of one score per line. Im having trouble with the whole #include <fstream> file and how to lay it all out in visual studio.
I need to write a c program that opens a file in note pad. The first line is the number 5, for how many rows of binary strings are to follow. Each line contains a string representing a binary number (with a maximum of 32 binary digits) The program is supposed to read this file, and convert each binary number to base 10.
This is the binary code to test: 5 0110010101010100100101 10110 10000
I want to be able to type a message into another program (such as notepad) using C++. How would I do that? Is there a function to do this, or an event, or something?
Create a notepad that allows the user to write text on the console. For this purpose, the user should be able to control and track the movement of the cursor. The user can access, add and delete any part of the text. To add or delete a text, the user can take the cursor to that location (using the arrow keys) and perform the required operation. The working of the program (i.e. the movement of the cursor, add and delete operation) must be consistent with the working of the real notepad. However, you do not have to handle word wrapping.
In addition, the user should be able to save and load the data in a text file using S and L respectively. The program will automatically save the data in file save.txt, and load the data from the same file. There is no need to ask the user for the file name. Use Q to quit the notepad. Don’t forget to implement the destructor.
Internally, the notepad is composed of two-dimensional doubly linkedlist. Its implementation is just like a doubly linked list with an additional property that it can grow in two dimensions. Since text can be written on multi lines, each row of the 2D-linkedlist represents one line. Each node contains four links which it uses to connect to node before, after, below and above it. In addition each node can store a character.
I have this problem set that has to use recursion to permutate scores. I have read in all the numbers and have tested that it works . l have also attached what I have so far. Here is what I think I need to do:I have to pass the structs into this permutation algorithm that is here:
Code: #include <stdio.h> void ListPermutations(char str[]); void RecursivePermute(char str[], int k); void ExchangeCharacters(char str[], int i, int j);
I am in comp. Sci 1 at my school and I have to write a program that deals with gamer scores and the trophy they get according to expert level. For example Tom is a beginner and gets a gold medal if >=10000 a silver >= 7500 bronze if >= 5000 and no trophy if he score <5000 ! I have do this scoring for Beginner, Immediate and Expert.
Should I set up the beginning like this:
case'b': case 'B': if (score >= 10000 ) trophy= gold if (score >= 7500) trophy = silver if (score >= 5000) trophy= bronze else = none
Not really sure how to go about solving this problem
I'm trying to basically have a user input the amount of test they want averaged, then have the user input the test scores. Send the test scores to a function and have them ordered in ascending then send it to another function that averages it. When I wrote the function I keep getting the address back instead of the actual values.
I have a program that allows the user to enter a specific number of test scores. Based on these test scores, the program should display the average score and calculate how many of the scores were above 90. I have most of it done but I'm having trouble figuring out how to calculate the number of scores that were above 90. What am I doing wrong?
This is my code:
#include <iostream> #include <iomanip> using namespace std; // Function prototypes double average(double*, int); int howManyA(double*, int);
i have so far, and im having trouble finding a way to store 5 test scores for each student that has been entered. for example: enter name: chaotic enter id number: 12312312
Enter test score 1: Enter test score 2: Enter test score 3 etc.......
Write a program that scores a blackjack hand. In blackjack, a player receives from two to five cards. The cards 2 through 10 are scored as 2 through 10 points each. The face cards - jack, queen, and king are scored as 10 points. The goal is to come as close to a score of 21 as possible without going over 21. Hence, any score over 21 is called "busted". The ace can count as either 1 or 11, whichever is better for the user. For example, and ace and a 10 can be scored as either 11 or 21. Since 21 is a better score, this hand is scored as 21. An ace and two 8s can be scored as either 17 or 27. Since 27 is a "busted" score, this hand is scored as 17.
The user is asked how many cards she or he has, and the user responds with one of the integers 2,3,4, or 5. The user is then asked for the card values. Card values are 2 through 10, jack, queen, king, and ace. A good way to hande input is to use the type char so that the card input 2, for example, is read as the character '2', rather than as the number 2. Input the values 2 through 9 as the characters '2' through '9'. Input the values 10, jack, queen, king, and ace as the characters 't', 'j', 'q', 'k', and 'a'. (Of course, the user does not type in the single quotes.) Be sure to allow upper - as well as lowercase letters as input.
After reading in the values, the program should convert them from character values to numeric card scores, taking special care for aces. The output is either a number between 2 and 21 (inclusive) or the word Busted. Use fucntions, multiway branches, switch statements or nested if-else statements. Your program should include a loop that lets the user repeat the calculation until they are done doing so.
The code runs properly for the first card but then it asks if the user wishes to repest the program. I need to claculate the value of all cards before it asks for that. Here is my code:
#include <iostream> using namespace std; int main() {
I am currently in a beginner C programming class. I have written most of my code and the problem that I am running into when i compile and run the code. I am able to input more than required scores for input. I think my code is wrong from line 126-136. The program runs fine with no errors. I'm just unable to input the required number of scores allowed.
/************************************************************************* * A program to calculate grade. *************************************************************************/ #include <stdio.h> #include <ctype.h> #include <stdlib.h>
float total, avg, max, min; float judge[4]; int index; int array[2]; int main() { total = 0.0;
[Code] ....
At a diving competition, the mark given to each diver is awarded as follows:
There are a number of judges and each judge gives a mark and the final mark is found by leaving out the highest mark and the lowest mark and calculating the average of the rest.
Write a C program that reads in the number of judges at the competition and then reads in a mark for each judge. Perform the necessary calculations and display the highest mark, the lowest mark and the final mark.
The following data checks must be carried out in the program:
a)the number of judges must be from 4 to 8
/>each judge can give a mark from 0.0 to 10.0 (a real number that may include fractions)
If an invalid amount is entered, the program must ask for an acceptable value to be entered instead.
Note: this program does not need an array. However, you can use an array if you want to.
Write a program that allows a user to enter high scores of a game, keeping tracking of the name of the user and the score. Add the ability to show the highest score for each user, all scores for a particular user, all scores from all users, and the list of users.
This is the program I am trying to write, however I am having difficulty storing the users name and high score, I know I need to store an array for the score but getting confused because of the structure. (By the way I have to use structures as it is a problem from the structures chapter of the ebook I am doing). Below is my code so far. .
Code:
#include <iostream> #include <string> using namespace std; struct highScore { string user; int score; int highestScore; int allScores;
I was doing a side programming challenge in my workbook that asked me to dynamically allocate and array for test scores. So far I have an array that will accept an integer to allocate the amount of test scores and then will accept integers to populate the array, however when I try to cout the contents of the array the numbers are absurdly different than what was put in. Here's my code:
#include "stdafx.h" #include <iostream> using namespace std; void main() { cout << "How many test scores?" << endl; int scores(0);
[Code] ....
And this is the output screen: How many test scores? 4 Enter test score 1: 22 Enter test score 2: 33 Enter test score 3: 44 Enter test score 4: 55 -33686019 18472 55656634 201345063 Press any key to continue . . .
Why am I getting these crazy numbers? I've looked back and forth from examples in my book and it doesn't look like I'm doing anything wrong.
My program reads data from a txt file and it displays the test scores and the sum of the scores, and it also shows the max and min from the scores , so far only one number shows up from the scores instead 10 and i think my sum is wrong too, but i cant get the max and min to work ...
I have to write a program in which it is to compute the mean and standard deviation from a set of 10 random scores between 1 and 20. The C++ program should generate a set of scores randomly and then, compute the mean and standard deviation from such a set of scores.
I was asked to create a C++ program that allows a user to take a test with series of different questions, and also retake the test if they choose to. I have been able to do that. But the other condition is to display the highest and lowest scores (highest and lowest correct answers) the user got, and in which test they got that score. For example, if the user takes the test 3 times, in which test did they get the highest score, and in which did they get the lowest score.
This is how far I went with the program. The code below only let the user take the test as much as they want, and tell them how many times they took it, and the last score they had. My idea is this, if I can make a variable store each test score, then I can compare them. But since there is no definite number of tests to be taken.
#include <iostream> #include <string> using namespace std; void main() { int correct = 0; int wrong = 0;
I'm trying to get the program to read from a file of 15 scores. 10 are quizzes 5 are exams. I want my program to read from the input file the first name "or" last name and if the user puts a different name, the program Gives off an error screen message
Code: #include <iostream> #include <fstream> #include <string> #include <cstdlib> using namespace std; const int NUM_STUDENTS = 20; const int NUM_QUIZZES = 10; const int NUM_EXAMS = 5;
Write a program that prompts for and reads in test scores. You may assume that valid test scores will be integer values between 0 and 100. You may also assume that the user will not enter more than 35 test scores. Use a preprocessor directive to define this value. User input will be complete when the user enters a -1 for the test score. When all of the test scores have been entered, the program will print out the scores. Use a while or do-while loop to read in the values. Use a for loop to print out the values.
Sample output: Enter test score 1: 88 Enter test score 2: 67 Enter test score 3: 74 Enter test score 4: 94 Enter test score 5: 79 Enter test score 6: 56 Enter test score 7: -1 Number of scores entered: 6 Test scores entered : 88 67 74 94 79 56
I need to sort these students based on their test scores.
My biggest problem is with my sort function. I am not sure of the syntax to call the items the proper way. I also don't know how to call the function properly as I know that i can't pass a int to a struct. Also not sure about the z malloc. Just threw that one in there.
Code: struct student{ int id; int score; }; void sort(struct student* students, int n){ /*Sort the n students based on their score*/