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


ADVERTISEMENT

C++ :: Program Should Input Each Student Grade As Integer And Store Grade In Vector

Jun 26, 2013

I get so close, and then it seems my brain shuts down ... I need to write a program that outputs a histogram of student grades for an assignment. The program should input each student's grade as an integer and store the grade in a vector. Grades should be entered until the user enters -1 for a grade. The program should then scan through the vector and compute the histogram. In computing the histogram, the minimum value for a grade is 0, but your program should determine the maximum value entered by the user. Use a dynamic array to store the histogram. Output the histogram to the console. For example, if the input is:

20
30
4
20
30
30
-1

Then the output should be:

Number of 4’s: 1
Number of 20’s: 2
Number of 30’s: 3

I can't quite get my output to look like that:

/* This program will display the histogram of student grades for an assignment */
#include <iostream>
#include <vector>
#include <stdlib.h>
#include <conio.h>

[code]......

View 3 Replies View Related

C :: Calculate Final Grade By Adding 4 Numbers Minus Lowest Grade And Dividing By 3

Apr 7, 2013

I'm writing a program to calculate a final grade by adding 4 numbers minus the lowest grade and dividing by 3. My knowledge in c is not extensive I thought that a simple assigment operator would do the job but I'm getting a strange large numbers in the execution.

Code:
#include <stdio.h>
#include <stdlib.h>
main(){
int eg, g1, g2, g3, g4, fg, s1, s2, sg;

[Code] ....

View 4 Replies View Related

C++ :: Grading Scale - Determine Letter Grade Based On Numerical Grade

Apr 23, 2014

I have to accept the numerical grade and determine the letter grade that the user will receive. I have to use a grading table to determine the letter grade based on the numerical grade. The Letter Grade table is

A 90-100
B 80-89
C 70-79
D 60-69
F 59 and below

Here is the code

//preprocessor directives
#include <iostream>
#include <string>

//namespace statement
using namespace std;

//function prototypes
void getData (string& course, string& first, string& last, int& grade);

[Code] ......

As you can see, I am currently stuck on the determineGrade one

View 1 Replies View Related

C :: Convert A Number Grade To A Letter Grade

Feb 24, 2013

i'm having trouble with my c programming assignment. i'm trying to convert a number grade to a letter grade. I'm trying to Write a function (called: numToLetter) that takes as input a number from 0 to 100 and returns a character ( a single character ), based on the following: if the number is between 60 and 70 return Dif the number is greater than 90 return Aif the number is between 70 and 80 return Cif the number is between 0 and 60 return Fif the number is between 80 and 90, return B and i need to use the return statements to call the function like for example:

if (a > 90) return ('A');
elseif (a > 80)
return ('B');
elseif (a > 70)
return ('C'); else
return ('F');

how do if write my code with this function?

View 1 Replies View Related

C++ :: Address Book - Add / View Entries

Sep 3, 2014

This program is an address book where you caan add/view entries. I'm having a problem printing out entries. Why the information isn't getting saved into the structure array?

Code:
#include <iostream>
#include <string>
using namespace std;
struct contactinfo

[Code] .....

View 1 Replies View Related

C :: Book Database - File Output

Feb 7, 2013

Book database. I use scanf to store book name,author name and year when is book written. Example:

Code:
scanf(" %[^
]",k[i].bookname);

I have problem when i want to printf all books from database with this:

Code:
for(i=0;i<counter;i++){
fscanf(f,"%s %s %d",k[i].bookname,k[i].author,&k[i].year);
printf("
%d %s %s %d",(i+1),k[i].bookname,k[i].author,k[i].year);} Output:

Number Book name Author name Year
1 King John 0
2 William Shakespeare 1590

How can i fix this?

View 4 Replies View Related

C :: Readline Function From UNP Book And Syncterm

Jan 15, 2015

I'm writing a program that uses the readline() function that comes in the Unix Network Programming book, when I use telnet to connect to my server the function reads the input perfectly displaying the username as the user types it in. However, when using a telnet client called syncterm it accepts the user input but does *not* echo it on the screen and I can't figure out why.

View 3 Replies View Related

C :: How To Develop Address Book For Contacts

Feb 19, 2014

I have to develop an address book for contacts, and it has to be able to add contacts, delete them, and show them all while implementing dynamic memory allocation. I'm thinking I should be going with an array of structures, but I'm not sure how to handle that in the context of this problem. I realize deleting them will most likely end up just being me using the free function. i'm thinking I should show all the contacts with a for loop, but say u deleted contacts, and those memory spaces were now absent, how would I go about it because the looping structure would be flawed wouldn't it.

View 3 Replies View Related

C++ :: Address Book - Program Stops After Cin

Dec 6, 2013

the program is of an address book. the syntax is all fine, and the initial menu of options does show up. but once you punch in the cin, the program just stops.

View 9 Replies View Related

C :: Phone Book Saving To File And Retrieving

Jul 14, 2013

I am supposed to make this phone book save to a file and then be able to retrieve it.

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Phonebook_Contacts
{
char FirstName[20];
char LastName[20];
char PhoneNumber[20];
} phone;
}

[code]....

View 4 Replies View Related

C :: Creating Simple Address Book Struct - For Loop?

May 11, 2014

My address book will be simple, and the thing's that I'm expecting to use in it are :

Pointers, Linked Lists
Malloc
Structs
Typedefs
Makefile, header file
Putting functions into different program files

I have started the program trying to create a struct, and getting it working with a couple of entries before going onto user input and splitting it up.

Code:

#include <stdio.h>
#include <stdlib.h>
int main(void) {
// Struct type address book. Just a name, a number and a pointer

[Code] .....

I'm a bit lost at this point... My knee jerk thought is to create a for loop, and cycle through the list.

I'm not sure how this would apply to this though? Without using the familiar type of print loop such as :

Code:
for (i = 0; ;i++) {
printf("%i
", array[i];
}

I'm thinking that I need to create a temporary struct that can be used to assign the value of the next struct in the list, and then somehow print from that....

I'll try and write the logic out :

while temp != NULL (The last node value is assigned NULL to show us where the end of the list is)

create a temporary pointer that can be used to keep track of where we are in the list.

print out the current entry name and number

then assign the temp pointer value to the * next of the current struct. So if we are in entry1 the *next should be the address of entry 2.

Print out entry 2 name and number, assign entry 2 next to the temp value.

View 1 Replies View Related

C++ :: Program That Ask User To Input 5 Books With ISBN Title Of Book With Author

Jan 29, 2013

So I was asked to create a C++ program that will ask the user to input 5 books with the ISBN, Title of the book and author/s. It will ask for 3 authors, if the book has only one author, you should leave "author 2 and author 3" blank and display only one author. Thing is... I'm having a problem with the if else condition at the last part of my program. I cant seem to make it work.

#include <iostream>
#include <cstring>
#define SIZE 5
using namespace std;
int i;

[Code]...

View 9 Replies View Related

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++ :: 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++ :: 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++ :: 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

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++ :: How To Sort Names And Grades From Highest To Lowest

Oct 28, 2014

How do I sort names and grades in C from highest to lowest?

John 91
Joseph 92
Mary 93
Jake 94

Sorted Scores from highest to lowest

Jake 94
Mary 93
Joseph 92
John 91

View 2 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/C++ :: Calculating Grade And Average?

Dec 10, 2014

Write a program to compute average grades for a course. The course records are in a single file and are organized according to the following format: Each line contains a student's first name, then one space, then the student's last name, then one space, then some number of quiz scores that, if they exist, are separated by one space. Each student will have zero to ten scores, and each score is an integer not greater than 100. Your program will read data from this file and write its output to a second file. The data in the output file will be nearly the same as the data in the input file except that you will print the names as last_name, first_name and there will be one additional number at the end of each line: the average of the student's ten quiz scores.

The output file must be formatted such that first and last names appear together in a left justified column that is 20 characters wide where the last name comes first, then a comma and a space and then the first name. Use your read string function to read each name separately and then put them together into a larger correctly formatted string before trying to output them. Each quiz score should be listed in a right justified column that is 4 characters wide, and the average should appear in its own right justified column that is 10 characters wide.

Note that if a student has fewer than 10 scores, the average is still the sum of the quiz scores divided by 10; these students are assumed to have missed one or more of the quizzes. The output file should contain a line (or lines) at the beginning of the file providing appropriate column headings.

This is how much I have so far:

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
char* read_string(char* buffer, int max_size, FILE* fp);
int main(int argc, char *argv[]) {
FILE *fp_input, *fp_output;

[code]....

View 7 Replies View Related

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 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







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