C/C++ :: Numeric Score To Letter Grade

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


ADVERTISEMENT

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 :: Trying To Match Student ID With Highest Score Along With Grade

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

C/C++ :: Student Input Name And Score / Output Grade

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

C/C++ :: GPA Calculator When Given Letter Grade For Various Courses?

Jul 5, 2014

Write a program which is used to calculate the GPA based on the grades for different courses input by user. User should be able to use this to enter grades for as many courses as he wants unless he wants to quit. (you may consider using some loop). Once user has completed entering of data, the program should be able to provide a feedback to the user about the GPA. A is equal to 4, B is equal to 3, C is equal to 2, D is equal to 1, rest are 0. Use minimum 5 course to demonstrate working of your code.

Here is an example (User input is in italic and bold):

Would you like to enter grades: Y

Please enter the course name: COSC1301

Please enter your grade: A

Would you like to enter more grades: Y

Please enter the course name:ITSE1301

Please enter your grade: B

Would you like to enter more grades: Y

Please enter the course name:ITSE2409

[code]....

View 4 Replies View Related

C++ :: Program To Calculate A Grade Letter Into Number?

Feb 7, 2013

So I have to write a program to calculate a grade letter into a number.

Letter grades are A, B, C, D, and F, possibly followed by + or –. Their numeric values are 4, 3, 2, 1, and 0. There is no F+ or F–. A + increases the numeric value by 0.3, a – decreases it by 0.3. If the letter grade is illegal (such as "Z"), then your output should be "INVALID LETTER GRADE"; If the combination is illegal (such as "A+" or "F-") then your output should be "INVALID GRADE COMBINATION"

Also the code should look like this
Enter your letter grade: C+
Grade value is [2.3]

// Input
cout << "Enter your letter grade: ";
string s;
cin >> s;

[Code].....

View 2 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++ :: 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/C++ :: Array To Only Print Out Final Average And Final Maximum Score With Final Minimum Score

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

C :: How To Enable Numeric Variables

May 22, 2013

working on this code I have encountered a few issues. My program lists the occurrence of each letter but i'm unsure of how to enable numeric variables. how to improve the overall quality of the code.

Code:

#include <stdio.h>
#include <string.h>
int main()
{
char string[100], ch;
int c = 0, count[26] = {0};
printf("Enter a string

[Code]...

View 4 Replies View Related

C :: How To Check Input For Non Numeric Value

Mar 20, 2013

Description: This program asks the user to enter a Fahrenheit temperature and then converts it into Celsius and Kelvin temperature.

Code :

#include <stdio.h>
void Temperatures(double temp_F);
int main(void) {
double temp;

[Code]...

View 6 Replies View Related

C++ :: How To Convert Char Into Numeric Value

Jan 1, 2015

when I was looking for a way how to convert char into numeric value for std::cout I found some old discussion with this statement: Operations on unsigned int are typically faster than on unsigned char, because your processor cannot fetch single bytes but has to get at least a multiple of 4 and mask out the other 3 bytes. Is this true? By using smaller (in bytes) variable I actually slow down my program? I always thought that it is a good practice if I use the smallest variable which will do the work. Is it also dependent on a compiler and OS?

View 2 Replies View Related

C# :: Possible To Convert Char Into Numeric Value

Feb 22, 2014

I want to avoid converting the char[] into a string as an intermediate step, since I'm trying to write some "string" parser helpers which don't allocate a bunch of different strings onto the heap. (whole point of this little project is to reduce GC pressure in applications that do alot of string parsing).

basically if I have a char[] that contains {'1','2','3'}, I'd want to to be converted into 123.

I tried messing around with the stackalloc operator in C#, but its illegal to stackalloc a string unfortunately. I also googled around for converting a char[] into a numeric value, but all the solutions convert each individual char into their ASCII code, or convert the char[] into a string as an intermediate step.

View 12 Replies View Related

C# :: Creating Object That Uses Numeric Up / Down And Track Bar?

Nov 19, 2013

I want to create an object that uses visual C#'s Numeric Up/Down and a Track bar.

The reason is that I have a GUI that uses lots of these linked together with events and I want a common event handler for all of them.

Maybe just adding a property that is a Numeric Up/Down in the Track bar and vice-versa will allow me to create a common event for all of these pairs.

View 1 Replies View Related

C++ :: Numeric Conversion - How To Convert Int Into String

Jun 3, 2013

How to convert int into string ? I had done conversion string to int.

My code :

/*Convert string into int using stringstream */
#include <iostream>
#include <string>
#include "console.h"
#include <sstream>
using namespace std;

[Code] .....

View 3 Replies View Related

C++ ::  Expected Identifier With Numeric Limits

Aug 22, 2014

I'm trying to perform a simple input operation, and check to make sure that whatever the user input is a valid input (is within data type bounds, is correct data type...). But when I get to ignoring the input, I keep getting an error.

unsigned short num;
while (true) {
std::cin >> num;
if (std::cin.fail()) {
num = 1;

[Code] ....

I don't fully understand why this error is here.

View 6 Replies View Related

C/C++ :: How To Multiply And Divide 2 Numeric String

Mar 28, 2014

I want to multiply and divide 2 string that contains number. For example

s1=4 and s2=8 s1*s2=32 ,s2/s1=2

I don't want convert string to integer and do it.because i deal with big numbers.and these should be in string form.

View 1 Replies View Related

C Sharp :: Numeric Up Down Hides Its Value From The User

Oct 17, 2014

I have a button which selects a particular tab and tab page on a form. This tab page has an embedded tab control with several more pages.

When I click on this button, the desired tab page is selected, but the NumericUpDown value (which is on the tab page) is not visible. The value is the current year.

Could it be that somehow, the click event for the button is hiding the value?

View 8 Replies View Related

C/C++ :: Error Before Numeric Constant Location

Jul 9, 2013

this is my code in c++ and its very simpile but wont compile

#include <iostream>  
using namespace std;  
int main() {  
    cout << "Here is some text 
";
    cout << "Here is a number: ";

[Code] ...

View 1 Replies View Related

C++ :: How Can Numeric Values Stored As Strings Be Converted To Numbers

May 16, 2013

I need to check my understanding from some questions about strings. How can numeric values stored as Strings be converted to numbers?

a)vector of required numeric data type
b)atoi function in cstdlib library
c)cout statement with required numeric data type

I picked b), I am aware of atoi, atol, and atof as methods to convert, but are there other methods?

What is the purpose of strncat function?

Combines n characters from source string into target string

C++ string provides:

a)convenient way to declare and manage character arrays
b)functions to manipulate strings
c)all of the above
d)none of the above

I picked c)

View 2 Replies View Related

C/C++ :: Read In Numeric Representation Of Date And Prints It Out In Formatted Manner

Oct 13, 2014

Write a program that reads in the numeric representation of a date and prints it out in a formatted manner as the box below.

1. If the user entered an invalid number for the month it should display "Invalid Month"
2. If the user entered an invalid number for the date it should display "Invalid Date"
3. Check to see if the day is outside the range for that particular month

An example of the input and the output:
Enter the date: 1 24 2013
The date you entered is: 1242013

Im not sure on how to go about this problem, but this is what I have.

#include <stdio.h>
int main(void) {
int a, b, c;
int status;
printf("Enter the Date");
status = scanf("%d,%d,%d",&a, &b, &c);
printf(" The Date is : %d",status);
return 0;
}

Am I going about this right? Is there an easier or better way to go about it? All that happens is that the program reads the first number and spits that back out.

View 5 Replies View Related

C# :: SQLException - Error Converting Data Type Varchar To Numeric

Oct 22, 2014

I am writing a simple program to suck in a txt file then pump it into sql.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data.OleDb;
using System.Data.SqlClient;

[Code] ......

How I can get past this error and get the data into sql? I read a couple articles on .tag but not sure I understand what to do.

View 11 Replies View Related

C :: Write A Program That Converts Alphanumeric Phone Number Into Numeric Form

Mar 6, 2015

i m learning c programming and i m stuck with this program for some reason.Write a program that converts alphanumeric phone number into numeric form:

O/P:
Enter phone number: CALLAT 2255288
here is the code i have written:
/** compilers shows no error **/
and O/P I get is
Enter phone number: CALLAT
/**blank space***/

Code:

#include<stdio.h>
int main(void)
{
char ch;
printf("Enter phone number:");
ch=getchar();
}

[code]....

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







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