C++ :: Adding Students And Calculating Their Marks
Feb 20, 2013
I need to write a program on that language. I start with the explanation: The program has 3 tasks:
First: User can add the First Names, Second Names, Third Names and the Marks of a students.
Second: The program can calculate the Avarege Marks of the students.
Third: To show the students that have marks more than 5.50.
View 1 Replies
ADVERTISEMENT
Mar 10, 2013
Write a program that a prof can use to enter the test marks of several students and which calculates the average mark of each student. Ask the user how many students he has, then ask him to enter each student's marks. When 999 is entered, calculate the average mark for that student (not counting the 999) and print the average. Then go on to the next students until the marks for all students have been entered, calculated and the average printed.
Code:
#include<stdio.h>
main() {
float student,mark,total=0;
float a,b,c;
int num = 999;
printf("
[Code] .....
View 2 Replies
View Related
Feb 28, 2014
Q.1 Write a program to store marks obtained by 50 students. Initialise the array having passed to a function initilise() having passed the array as parameter. Write another function which should take this array as parameter and return the highest score from the array. you have to write the proper function call, prototype and definition for each function.
And this is the program which i wrote and got errors: -
#include<iostream.h>
#include<conio.h>
#define s 50
void init(int m[s]);
void display(int m[s]);
void find_max(int max, int m[s]);
void main(){
clrscr();
int max;
[code]....
View 1 Replies
View Related
Feb 14, 2015
Write a C++ program to output information for three students. The information stored in your program contains student’s first name, middle name, last name, and test score. The following shows the information for the three students, where test score is in the int type.
John Jacob Smith 78
Mary Jane Weems 82
Dave Joe Dale 61
Your program should declare three named string constants for the three students. Each constant contains the student’s first name, middle name, and last name. You may use three int variables to hold values for the three test scores. The first name, middle name, and last name of a student are then extracted using the substr() function shown in class. Your program should also compute the average (in floating-point number format) for the three test scores. The average score computed should be printed to the screen with 2 digits displayed after the decimal point.
The following shows the output from the program. Note that all the output is left-justified with 15 character positions reserved for each.
first name middlename lastname testscore average
John Jacob Smith 78 73.67
Mary Jane Weems 82 73.67
Dave Joe Dale 61 73.67
View 1 Replies
View Related
Nov 18, 2014
So I am currently in the middle of learning c++ and I decided to jump ahead of the book and tried to do add procedures. My goal is to have main calling other procedures such as welcome message().
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
#define MIN_HOURS 0.00 // minimum hours per week
#define MAX_HOURS 60.00 // maximum hours per week
#define MIN_RATE 0.00 // minimum pay rate
#define MAX_RATE 99.99 // maximum pay rate
[Code] .....
View 5 Replies
View Related
Aug 15, 2013
Code to accept the information of 5 students and display the information of first 3 students......
Code:
#include<stdio.h>
main() {
struct stud {
char name[20];
int rollno;
float per;
char grade;
[Code] ....
View 6 Replies
View Related
Jun 13, 2014
#include <iostream>
#include <string>
using namespace std;
void secondq();
void thirdq();
[Code]....
View 2 Replies
View Related
Aug 14, 2012
i wnt to display student who get highest marks among them...i have code for finding maximum marks from them but don't kne how to print only top 5 student...
Code:
static void Main(string[] args)
{
Console.WriteLine("Please Enter Number of Students :");
int n = Convert.ToInt32(Console.ReadLine());
StudentDetails[] student = new StudentDetails[n];
for (int row = 0; row < n; row++)
{
Console.WriteLine("Please Enter Student name :");
[Code]...
(dis code in Visual Studio)
View 6 Replies
View Related
May 13, 2014
I need a program. I need to add the data of five students their mobile number,address,sec, and deprtmnt....program should be like:
s.no name address phone
1.
2.
3.
4.
5.
And starting should be like press 1 to insert data
press 2 to save data
press 3 to find data
press 4 to quit
View 5 Replies
View Related
Oct 30, 2013
Code:
#include<stdio.h>
int calcAbvAvg(int marks[10], int avg) {
int students = 0;
int i;
for(i=0;i<10;i++)
[Code] .....
I suck at function and linked list. The only problem i am having in this question is the function calcAbvAbg() not working! I want that function to display the students who are above and below average!
View 4 Replies
View Related
Feb 28, 2013
I have to search an array of struct students on the basis of their first names, last names and roll numbers .. so far i am done with the input of the student first , last names and roll numbers . I have problem in searching the array ..
Code:
#include <iostream> Code: #include <string>
using namespace std;
struct Student {
string FirstName ;
string LastName ;
[Code] ....
View 5 Replies
View Related
Apr 12, 2014
So here I have a program that is supposed to basically sort out who passed and failed. I am currently stuck on the switch statement, I'm trying to count how many students received an A, B, C, etc.
Here's what I have so far:
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
void printIdInfo(ofstream &fout);
void printColumnHeaders(ofstream &fout);
[Code] ....
View 1 Replies
View Related
Nov 29, 2014
I have learnt about string class, file I/O and pointers. Now I am asked to write a program that includes the above topics, basically testing the ability to use dynamic arrays.
I've got 2 documents, namely "Students.txt" and "EnrollRecords.txt". "Students.txt" includes 40 students' info, which are university ID, programme names and their names. These 40 students are all BEng but from different departments.
E.g. 20141129 BEng(Civil) Tom Jerry
"EnrollRecords.txt" includes 166 data, which are course codes, university ID, respective scores in the test and GPA. In this document, the same student can have several scores of different courses' tests. So their uids repeat in it. And this document only contains the data of the Department of Computer Science. So students exist in the "Students.txt" may not exist in this document.
So my task is that the user enter a name (e.g. John), then the programme will know to find John and his uid, and get all the GPA of the courses that he has taken to calculate the average GPA.
E.g. 20147777 BEng(CompSc) John David //this is a John we are looking for in the "Students.txt"
//line 15 COMP1220 20147777 90 4 //so we find 3 courses in "ErollRecords.txt" that John has taken
//line 50 COMP1500 20147777 85 3.3
//line 88 ENGG2012 2014777 70 2.3
The programme should display :
20147777 3.2
To able to do anything for this task, I am asked to define 4 struct types:
struct Student {
int uid;
string programme;
string name;
[Code] ....
So now I am going to write a function queryD(Database d, string searchName) and any necessary functions in it. I am able to do the search part,
void queryD(Database d, string searchName) {
for (int i = 0; i < d.numberOfStudents; i++) {
if (d.students[i].name.substr(0, searchName.length()) == searchName) {
match_uid(d);
[Code] ....
But I struggle in how to match the uid in "Students.txt" and "EnrollRecords.txt" . Because there are repeated data for the same student in "ErollRecords.txt". So how am I gonna be able to match the uid and do the calculation? I get stuck in the for loop part...
View 1 Replies
View Related
Jun 27, 2014
I need to create a program that continuously records data until the user enters '0'
The data that I read in is the student's last name, the year of the student (1-4), the major, the gpa, and the advisors name. I then need to print out how many students are in each year (1-4), the number of students each advisor has, the average gpa for each major, and so on. This is what I have, but I am stuck and think that I might be headed the wrong direction because the only thing working is the loop (not my gpa test calc).
//This program displays information pertaining to students
#include <iostream>
#include <string>
using namespace std;
int main () {
int studYear;
double average, studGpa;
string studName, studMajor, studAdvisor, complete;
[code]....
View 2 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
Feb 27, 2015
//USG ELECTION
//Voting Program
#include <iostream>
[Code]....
View 6 Replies
View Related
Feb 20, 2014
I'm working on a program that shows all the students enrolled in certain courses.
This is what the correct solution is supposed to output:
enrollmentReport.exe sections0.dat enrollment0.dat
Undergraduate enrollments: 1
Graduate Enrollments: 3
CS 355
23272:Line, S.: 1 students
Squyres, Kristen
CS 571
22000:Caro, Virgil: 2 students
Arnold, Hayley
Aiken, Roberto
22002:Caro, Virgil: 2 students
Belur, Shirley
Aiken, Roberto
This is the output I get:
Undergraduate enrollments: 0
Graduate Enrollments: 0
CS 355
CS 571
I've included all the source code in an attachment. The trick is that I can only modify the section.h and section.cpp
course.zip (523.39K)
View 5 Replies
View Related
Sep 28, 2013
There are 3 students (0=John, 1=Peter, 2=William) sharing their meals. Who does the cooking, does the shopping and pays for the bills. End of the month they sum it all up and settle the bills equally. Who must pay the most is outputted at the top, while the person that collects most is at the bottom. Students that have to pay the same amount are listed in the same order as they are ordered in the input. (receiving same amount, the same). Total of the settlement are rounded to whole cents. Sometimes they loose a cent, sometimes they gain one.
So I started making a plan what the program is supposed to do. Pen and paper:
1. Sum of the total amount from all the meals.
JohnPaid+PeterPaid+WilliamPaid=Total
Total / 3 = FairShare
calculate difference of all three the students
if JohnPaid == FairShare
print John receives 0.00
if JohnPaid > FairShare
print John receives difference
if JohnPaid < FairShare
print John pays difference
etc. (same for Peter and William)
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
/* type definition of student */
typedef struct student {
int who; /* 0=John, 1=Peter, 2=William */
float paid; /* amount that student paid */
[Code] .....
Example in/outputs:
<0 39.85>
<1 30.83>
<2 35.43>
Peter pays 4.54
William receives 0.06
John receives 4.48
<1 106.32>
<0 88.14>
<2 88.14>
John pays 6.06
William pays 6.06
Peter receivers 12.12
Looking at this code, I see a lot of global (general) variables. Do I need to adjust this skeleton code I received or should I just add code?
View 6 Replies
View Related
Apr 25, 2013
I am doing a c project .it is a system that stores the name of txt format reports made by students and opens them.
View 1 Replies
View Related
Jan 18, 2014
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*/
[Code] ....
View 5 Replies
View Related
Jan 17, 2014
This is the program below..can you spot the errors in it.. I am getting lots of errors...!!
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
struct student {
char name[10];
int rollnumber,result
float m1,m2,m3,total
[Code] .....
View 12 Replies
View Related
Apr 18, 2013
Trying to write a program that calculates a students grade based on how many assignments have been graded. I am using a switch case since there is a total of 5 assignments, however when I enter case 1, and enter in how many I got out of 100, it just closes the program it doesn't go to the next part.
#include <iostream>
using namespace std;
char calculategrade(int total);
int main() {
// local variable declaration:
char input;
[Code]....
View 6 Replies
View Related
Oct 7, 2014
NOTES AT BOTTOM---EXPLANTION, PROBLEMS ETC. SCROLL DOWN
#include <iostream>
#include <iomanip>
#include <string>
[Code]....
I have to write a program that stores information about students and displays results (Formated). Example-
Inputs ( # of students, First and Last name of student, the gender, age, and hieght. (height inputed as inches and outputed as feet and inches))
Student 2
---------
Jett, Joan Female
100 years old 5' 7"
Ive been falling behind a little due to working late and barely having time for my school work. Coming across several issues, one being an error with GENDER (Error C4700: uninitialized local variable 'gender' used:). As well as how to format the end result, i understand that u have to use #include <iomanip>, but am confused on how to format correctly.
View 2 Replies
View Related
Jan 22, 2015
is this according to it??
#include <iostream>
#include <fstream>
using namespace std;
int main(void){
fstream file("textfile.txt");
int linecount = 0;
int tempArray[100];
[Code] ....
View 1 Replies
View Related
Jan 16, 2015
#include<fstream>
#include<iostream>
#include<string>
[Code]...
View 2 Replies
View Related
Aug 27, 2014
In the program I'm writing, I'm creating a linked list of students with individual data read from a file. At the moment, I have written two functions to accomplish this; one that creates a student node and fills it from a line file, and a second that calls on the first to create a linked list. It seems to work fine except for one thing; It seems that EOF is being reached first, but the function continues on anyways? Here is my code so far...
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct student
// Declaring student structure globally.
[Code] .....
And here is what the input file would look like...
Thui Bhu, 100, 90, 80, 100, 89, 99, 88
Ariana B. Smith, 90, 90, 100, 100, 99, 100, 95
Emily Gonzales, 100, 90, 100, 70, 78, 78, 80
Jennifer L, 80, 90, 90, 100, 89, 99, 85
Maria Jones, 65, 72, 77, 68, 62, 70, 65
Bill Gates, 60, 54, 38, 62, 65, 60, 50
Escobar Morris, 83, 77, 88, 76, 79, 72, 76
Anne Latner, 80, 80, 85, 95, 90, 95, 98
John Doe, 45, 87, 88, 89, 67, 96, 79
And here is what the output is...
EOF
EOF in create_record
Thui Bhu: 100 90 80 100 89 99 88
Ariana B. Smith: 90 90 100 100 99 100 95
Emily Gonzales: 100 90 100 70 78 78 80
Jennifer L: 80 90 90 100 89 99 85
Maria Jones: 65 72 77 68 62 70 65
Bill Gates: 60 54 38 62 65 60 50
Escobar Morris: 83 77 88 76 79 72 76
Anne Latner: 80 80 85 95 90 95 98
John Doe: 45 87 88 89 67 96 79
Press any key to continue . . .
View 2 Replies
View Related