C++ :: Program Compiles But Refuses To Print Out Char Grades?

Nov 10, 2014

#include <fstream>
#include <ostream>
#include <iostream>
#include <iomanip>

using namespace std;

const int NAMESIZE = 15;
const int MAXRECORDS = 50;

[Code] ....

View 2 Replies


ADVERTISEMENT

C++ :: Student Grades Do Not Print?

Mar 26, 2013

//******************************************************************************
// GradeCalculator.cpp
// Input: Student Grades in Each Category
// Output: Final Grade, Numerical Grade, Witty Comment
// Final Grade Calculator
// This program calculates a final grade using a formula, assigns a
// corresponding letter grade, and outputs a "witty" comment to the user.
//******************************************************************************

#include <iostream>
#include <fstream> // For file I/O
#include <string>
#include <iomanip>
#include <cmath>

using namespace std;

// Declare function prototypes
void OpenFiles(ifstream&, ofstream&);

[Code] .....

View 1 Replies View Related

C++ :: Program Compiles But Doesn't Run

Apr 28, 2013

My program compiles but doesn't run, Here is the screen shot of debugging

//DynBag.cpp : Implementation File
#include <stdexcept>
#include <iostream>
#include "DynBag.h"

[Code] .....

View 3 Replies View Related

C++ :: Program Compiles / Runs But Closes Right Away When Finished

Oct 15, 2013

Program compiles and runs no problem but closes right away when finished.

Heres the code:
Code: #include <iostream>
#include <cmath>
using namespace std;
double calcDistance(double,double, double, double);
float calcKilometers(float, const float) ;

[Code] ....

View 3 Replies View Related

C :: Program Compiles Fine But Seg Faults While Running

Dec 1, 2013

So i compile fine, but when i run my program, after the printf it just segfaults (core dumped)...

Code:
#include<stdio.h>#include<string.h>
#include<stdlib.h>
void main() {
unsigned int j=0, max=9;
char num[100] , str1[100], str2[max];
FILE *fp;

[Code] .....

View 4 Replies View Related

C++ :: Program Compiles Successfully But Calculations Give Wrong Answer

Feb 11, 2013

I'm using MSVC++ and it builds sucessfully but somewhere something is obviously messed it. Once i try to debug it just shows weird numbers.

int k=0; //could this be the problem??? since 0 would be over writing any given value. but if i leave int k; it showsa warning and MSVC would count that as an error

#include "stdafx.h" //Header file section
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
//structure declaration
struct menuitemtype

[Code] ......

View 14 Replies View Related

C++ :: Writing A Program To Calculate Grades

Apr 22, 2014

Writing a program to calculate grades... My algorithm is long, so I only posted the part that gives me trouble. When classes== 1,2,4, or 5, the program runs fine. but it terminates when classes == 3.

if (classes==3) {
do {
cout<<"Enter the Letter grade for 1st class. (USE CAPS)"<<endl;
cin>>grade1;

[Code].....

View 3 Replies View Related

C++ :: Use Functions In A Program To Show Names And Grades

May 19, 2013

how to use functions in a program to show the names and grades of students, their average, total, highest and lowest grades.

View 1 Replies View Related

C++ :: Finding Program That Calculates Student Grades?

Jun 7, 2013

I have to make a program that reads two student grades, the average of the two has to be 6, if you can not take an average of 6, will make a third test and calculate a new average.

I'm not getting the new display medium, without repeating the approved and disapproved?

// TRABAV2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[]) {

[code]....

View 1 Replies View Related

C++ :: Program That Prompts User For 10 Grades And Then Find Average

Feb 24, 2015

I need to write a program that prompts the user for 10 grades and then find the average. I have that part but I need to average to not include -1. How can I tell the program to not calculate -1 into the average.

#include <iostream>
using namespace std;
int main() {
//Declare variables
float grade[10]; // 10 array slots
int count;
float total = 0;
double average;

[code].....

View 1 Replies View Related

C++ :: Program That Compute Final Average Grades Of Class

Jan 28, 2013

An instructor needs you to write a program that will compute the final average grades in her class. There are 5 students in the class. Each student must take 2 exams and 4 quizzes as part of their final grade. The weight of each toward the final grade is as follows:

Exam 1 – 30%
Exam 2 – 30% Quiz 1 – 10%
Quiz 2 – 10%
Quiz 3 – 10%
Quiz 4 – 10%

You must use arrays to store each students 3 digit ID number, exam scores and quiz scores. A multi-dimensional array is mandatory. Request from the user the information needed then output all of the information as well as the final average grade for each student.

View 1 Replies View Related

C++ :: Write Program That Asks User To Enter Student Grades?

Jan 21, 2014

Write a program that asks the user to enter a student’s grades on four exams. The program should display the four grades and the average of the four grades,rounded to the nearest tenth. To add the grades, use a variable called total_grade, which you should initialize to zero.As the program prompts for and obtains each grade, add the grade to total_grade using the += operator.

View 3 Replies View Related

C :: Program That Grades A True / False Quiz - Data Available In Text File

Oct 14, 2014

You are to write a C program that grades a true-false quiz. The quiz data will be available in a text file; here is an example:

Quiz #8 (09/22/14) (corrected version)
TTFTTFTFTF
0080 TTFTTFTFTF
0340 TTFTFFTFTF

The first line in the data file is a comment that you may assume can be up to 80 charac- ters long; it cannot be blank. The second line contains the answer key for the 10-question true-false quiz. The following lines in the data file contain a student's id number in column 1 followed by their answers for the quiz in column 2. A 0 (zero) on a line by itself indicates that there are no more students to process.

Write a program that first reads in (from standard input; more on this in a moment) the comment line and answer key as strings followed by each student's data. Store the student's id numbers in an array. You are to "grade" each student's quiz using the key provided fol- lowed by recording their scores (in a second array) in order to be able to print them out later. You do not need to use an array of strings or characters in your program. Write your program allowing for up to 100 students, and you may assume that at least 1 student will have taken the quiz.

You should create test data text files and provide the data to your program using redirection from the command line (see the sample run below). Your program should output the number of students who took the quiz, the average score, the best score, and a table showing each student's id, score, and grade. The formatting, spacing, and labels in your output should 1 match the sample run below exactly.

Your program should determine each student's grade as follows: if the score is equal to the best score b or b−1, give an A. If it is b−2, award a B. Give C's for any score that is equal to b−3 or b−4, a D for b−5 and an F for all others.

Alright So I'm just stuck at comparing the key answer with student answer here is my code comparing one student's answer with the answer key . is that right ?? One more thing for some reason when i try to print answer[0] the result is nothing why is that

Code:
#include<stdio.h>
int main(void) {
char comment[80];
char answer [10];
char studentans [10];
int n=0,i=0,x=0;
int ID[10];

[Code] .....

View 1 Replies View Related

C :: Program To Calculate Students Grades From Input File And Write To Output File

Aug 29, 2014

One of my class assignments is to create a program that receive a .txt file containing a students name and their grades as follows:

John K. 99, 87, 57, 89, 90, 95
Amanda B. Jones 100, 88, 76, 99, 86, 92
etc..

The number of students is unknown until run time. You have to take those grades and average them weighing the first (4) at 10% a piece and the last (2) at 30% each.

Then return an output file with the students name and their letter grade A,B,C,D,F based on their computed score. In addition, on screen it needs to display the average scores for each Q1, Q2, etc. as well as the minimum and maximum for each test on the screen. I am having a hard time in assigning the scores to a variable so that they can then be computed as an average and then used to determine a letter grade. I have begun to write the code and am a bit stuck..here's what I have so far:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

[Code]....

View 2 Replies View Related

C/C++ :: Program To Compute Students Grades From File And Write Them To File?

Aug 31, 2014

We have to write a program that reads an input file containing data in the form:

Martha J, 80, 90, 90, 100, 89, 99, 85
Anna Smith, 65, 72, 77, 68, 62, 70, 65
Bill Gates, 60, 54, 89, 62, 65, 60, 50
...etc...

and then use that information to determine their letter grade and write that information to a .txt file. I have been able to successfully pass that information to a function to determine their letter grade and have been able to successfully compute their letter grade. However, I can get this information to successfully post within the *computeGrade () function. Yet, I don't know how to pass this information back to the main() on a student by student basis so that I can open a new .txt file and write just their name and letter grade to it.

Another issue I'm having is when it comes to computing the averages of the class. Each score is either a quiz (there are 4), a midterm (there are 2) or a final (there is 1). I'm a little stuck on how to pass say all of the quiz 1 grades as one entity to the function averagesminmax(). Is there a way to compile each of the grades for a specific quiz or midterm as one array and pass that to the function to then do the computation. Also we need the min and max so again from compiling the grades of a particular quiz or exam together as one.

Here's the code that I have so far.

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
const char *computeGrade();
int averagesminmax();
int main() {
char fName[20];
char lName[20];

[code]....

Do I need to re-read the input file and assign them to different variables?

Here's a sample of the output so far:

Enter input .txt file name
Graded
Thui Bhu, 91, A
Ariana B. Smith, 96, A
Emily Gonzales, 83, B
Jennifer L, 89, B
Maria Jones, 67, D
Bill Gates, 55, F
Escobar Morris, 78, C
Anne Latner, 88, B
Program ended with exit code: 0

Also in my output file, the only thing that it prints will be the first name of whatever the last student in the input file list is.

View 2 Replies View Related

C++ :: How To Print Unsigned Char

Apr 23, 2013

How do I print an unsigned char in c++? E.g.

unsigned char a[100] = "acdef";
wprintf(L"a is %u
", a);
wcout << "a is " << a << endl;

gives

a is 2880488
a is 002BF3E8

and not

a is acdef
a is acdef

??

what is the difference between unsigned char and char?

View 6 Replies View Related

C/C++ :: Read And Print A Char Array

Nov 25, 2014

In this project I need to develop few functions to work with graphics card. I work in minix and this is pretty rubbish.

I'm having an hard time to read a pixel map, or atleast ro print it on my main function.

I have a read_xpm function, which is given, therefore, working.

char *read_xpm(char *map[], int *wd, int *ht)

then I have a pixmap.h file which gives some examples of pixmap images that I can use as example:

static char *pic1[] = {
"32 13 4",
". 0",
"x 2",
"o 14",

[Code]....

I tried something like read_xpm(xi, yi, *xpm[0]); but I'm guessing I need to index that array and run all those chars in order to show them.

View 3 Replies View Related

C++ :: Code Compiles Successfully Yet Previous Day Is Blank

Feb 17, 2013

//#include "stdafx.h"
#include<iostream>
#include<cmath>

using namespace std;
//class declaration
class dayType{
public: int presday;

[Code] ....

So everything works perfectly, well not everything lol. Code compiles successfully without any errors but previous day does not calculate. In a sense that when it asks for number of previous days it returns a blank statement.

For example: Previous number day is: shows nothing

View 2 Replies View Related

C :: How To Print The Max Number Row In Relation To The Char Arrays Row

Mar 30, 2013

I have most of the code working properly, but I'm having trouble with a certain area. Currently I have multiple 2D arrays. One is a char array and the other is an int array. In the int array I have to find the max number in each column, which I've done. The problem is, I need to print the max number's row in relation to the char array's row.

For example,

Code: int array[2][3] = {60 50 30 0 100 1}

The max numbers are 60, 100, 30.

char array[2][length+1] = {nameOne nameTwo}

How it needs to print:

nameOne has max score of 60.
nameTwo has max score of 100.
nameOne has max score of 30.

I just can't understand how to compare the two arrays in the right way, so it'll know that nameOne is associated with the numbers in row 0 and nameTwo in row 1, etc.

View 1 Replies View Related

C++ :: Print Linked List But As A Vector Of Char

Aug 26, 2013

I was assigned to print a linked list but as a vector of char (I cannot use the normal string type) , this is what I have:

char* List::asString(){
Node* ite = new Node();
ite= first;//ite is like an iterator of the list
for(int i=0; i<sizeOfList; ++i){//sizeOfList is the total of node of the list

[Code] ....

But when I print that, I get a bunch of weird symbols...

View 7 Replies View Related

C++ :: Count Controlled Loop Than Can Print Char

Sep 27, 2012

Write a count controlled loop than can print "i" char. The user is supposed to input a integer and that integer is how many asterisks there is on the blade, in this case it is 5.

* *
** ** **---------------
*******
** ** **
* ** * -10 Rows high
** -blade always connects on second row of handle
**
**
**
**------------------

These are the steps he told us to do it in.

1) *
**
***
****
*****

2) *
**
***
****
*****
****
***
**
*

3) * *
** **
*** ***
**** ****
**********

4) * *
** **
*** ***
**** ****
**********
**** ****
*** ***
** **
* *

5)* *
** ** **
*******
** ** **
* ** *
**
**
**
**
**

View 4 Replies View Related

C++ :: Grade Book - Using Vector To Get The Grades

Sep 15, 2013

I am trying to make a grade book and using a vector to get the grades. I am getting errors all over and I figured this would happen because this is the first time I ever used vectors.

Code:
#ifndef ___2B__Homework__LetterGrade__
#define ___2B__Homework__LetterGrade__

#include <iostream>
#include <vector>

[Code] .....

View 12 Replies View Related

C++ :: Struct - Getting Grades Of The File Sorted

Jul 21, 2014

My code has no errors. I'm just having problems with getting the grades of the file sorted. grades is not a struct, but is a int inside struct School. Below is what I;m having problems with(this is just the code I started working with,I made a few changes but it didn't work,I have no clue)

void selectionSortG() {
Students min;
int key;
for (int i = 0; i < size; i++){
min = student[i];
key = i;
for (int k = i; k < size; k++)

[Code] ....

View 2 Replies View Related

C++ :: Arrays - Determine Grades At The End Of Semester

Jul 18, 2013

Write a C++ program that can be used to determine grades at the end of the semester. For each student, who is identified by an integer number between 1 and 60, four examination grades must be kept. Additionally, two final grade averages must be computed. The first grade average is simply the average of all four grades. The second grade average is computed by weighting the four grades as follows: the first grade gets a weight of 0.2, the second grade gets a weight of 0.3, the third grade a weight of 0.3, an the fourth grade a weight of 0.2; that is computed as:

0.3*grade1 + 0.2*grade2 + 0.2*grade3 + 0.3*grade4

Using this info, you are to construct a 60X7 two dimensional array, in which the first column used for the student number, the next four columns for the grades, and the last two columns for the computed final grades. The output of the program should be a display of the data in the completed array.

View 8 Replies View Related

C++ :: Calculating High / Low And Average For Grades

Feb 6, 2015

The bottom three functions do not work. Nor are the finished to the extent. I do not know how the data members are being accessed and is only giving me the last output. The overall goal of this program is to output the highest grade with student name and age, lowest grade with student name and age, and the average of all grades. The file is given and is commented out for you to see what the file looks like.

// Header Files
#include <iostream>
#include <fstream>
using namespace std;
// Global Constants
const int STD_STR_LEN = 10;

[Code] .....

View 5 Replies View Related

C/C++ :: Write Random Grades To File?

Jul 1, 2014

I need to write a program to store a user specified number of grades to a file, with one grade per line. random function to generate grades between a 55 and 100. When you open the file, it should be for writing, and not appending. Again, prompt the user for how many grades to generate, and store them in a file.

View 2 Replies View Related







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