C++ :: Printing Name And GPA Of Student?
Feb 17, 2015#include <iostream>
#include <string>
using namespace std;
struct studentType {
string name;
double gpa;
[Code] .....
#include <iostream>
#include <string>
using namespace std;
struct studentType {
string name;
double gpa;
[Code] .....
I have to get the average score for each student. And modify my avgmarks function and write the marks to a output txt file.
Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int bubble(int*,int);
void filewrite();
void avgmarks();
void fileprint();
void filesort();
void rollin();
[Code] .....
//******************************************************************************
// 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] .....
My assignment for class was to create a Student ADT. I have three files. First one is Student.h which defines a Student record and has the prototypes of the functions that can be used with Student. I have Student.cc which is where the functions are actually declared. And my final file is testStudent.cc where the "main" function is that is creating a Student and callign all of the functions to make sure they work properly.
I have all of the functions working properly, except for my destroyStudentRecord function. It is supposed to deallocate the record, but I am unsure of how to actually do this. The current implementation appears to only deallocate the firstName field, as when you display the record after deallocationg it, everything still shows up except the first name. I have tried deallocating each field of the record before deallocating the record itself and that gave me the biggest list of errors I have ever seen.
I realize the implementation of some things in here might be a bit odd, but this is exactly how we are required to do things for this assignment and nothing about the implementation can really be changed unless something is actually just plain wrong(which is of course a possibility as I am quite new to this!). As I said though, everything else is working exactly as it should be, so my only issue at all is with actually deleting the record once I have created one.
Student.h:
#include <iostream>
#include <cstdlib>
using namespace std;
#ifndef _STUDENT_H_
#define _STUDENT_H_
struct Student {
[Code] ....
I'm trying to add more student information to the specific txt file. I did struct my student information and separated it with an array with max size of 200.
The inside of my current file looks like
Toshi
Aka
Nonal
Donald
The first one represent student[0] and next one is student[1] and so on till student[199]. Right now, only 4 space is occupied, which means the array has information till student[3] but not from student[4] (I guess it has null condition).
What I want to do is, I want to add a new student information to student[4] and till student[199] once at each time.
So, my prompt will look like
Would like to add a new student? Y/N
(if yes goes to below statement and exit if NO)
Hi. Please enter the information of new student. ___________
Student added. Please press any key to continue.
If the key is pressed, it goes back to my initial prompt and continues till I press N.
I sure I'm not using for loop to do this thing, because I'm adding student name one by one.
However, the array is already occupied by other student name till student[3] so, I want to add a new student information to student[4] (I don't want to overwrite the current information). And if student[4] is occupied, then [5] and so on.
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)
I've remade a program to store student database using linked list. When I try to display the list of student with their information (It displays nothing)
Code:
#include <iostream>
#include <string>
using namespace std;
struct StudentRecord {
[Code] ....
For Example i have made a text file included some students data. Now i want to change just a single student data. That file should remain same just that student's data replace.
View 3 Replies View Relatedwhat is the process of student profiling system using c++?
View 2 Replies View RelatedSo I have to store a student Id and gpa and name in a linked list. I keep getting error messages.
Like: lab 20.cpp(43): error C2628: 'Student' followed by 'int' is illegal (did you forget a ';'?)
(43): error C3874: return type of 'main' should be 'int' instead of 'Student'
(71): error C2664: 'Student::Student(const Student &)' : cannot convert parameter 1 from 'int' to 'const Student &'
Reason: cannot convert from 'int' to 'const Student'
No constructor could take the source type, or constructor overload resolution was ambiguous
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
using namespace std;
struct Student {
string name;
double gpa;
[Code] ....
I am trying to use a class Student and declare it as a list type. I can pushback but without changing the List.h or Node.h how can I print the data in list2?
Node.h
#ifndef NODE_H
#defineNODE_H
#include <string>
[Code].....
I'm trying to write a table (2D array) with a string of random chars in one row for the student names, six other rows for the project numbers and random numbers for the grades.Then calculate the averages of grades per student and per project, add them as the last row and the last column. And write a menu of 4 options:
1- sort per student names (alphabetical order)
2- sort per student grades (in increasing order)
3- sort per project grades ( in increasing order)
4- exit
The program must continue execution after displaying any report, need to use an infinite loop, it exits only if the chosen 'exit'.
Here's what I have:
#include <ctime>
#include <string>
#include <iomanip>
#include <iostream>
using namespace std;
ints=12,p=6;
stringnames[20];
[Code] ....
And then, I need to show interactively the same report with all types of sorting:
sort table by any row, (user enters the row number)
sort table by any column. (user enters the col number)
sort table sorted by student names as well.
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...
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
}
[code]....
I dont know how to modify the previous record that i have done in the Add Student function. i searched from different sites and got this code for modifying a record in a text file. But, i cant figure it out why its not working.
The programme has to be a linked list to gather student info, (ie name, lastname, student no, and three grade); the first and last name must use malloc correctly, there must be an insert and delete function and a printfunction. and they must print out in alphabetical order.
Code:
#include #include #include struct student{
char *lastName;
char *firstName;
char dob[20];
char sID[20];
float grade;
[code] .....
I've been working on a student data base that reads in the students name, birth date, social security, and department name (or major). I have all these items in the header files respectively; nameType, dateType, personType, and studentType.
I am now to create another header file called HWONEHEADER that contains the functions showMenu, loadStudent, insertStudent, searchByName, and SaveStudents. This is how far ive gotten
#ifndef HW
#define HW
#include <iostream>
#include <fstream>
#include <iomanip>
#include "studentType.h"
[Code] .....
Here is the cpp file i have.
int main() {
studentType department;
cin>>department;
cout<<department;
[Code] .....
I need with the HWONEHEADER using the ifstream and ofstream operators to load all the students information into a file called student.dat I'am extremely confused because i can't find anything in my textbook about using ifstream and ofstream operators.
I have to read a particular student data from file using his Roll no and modify it and then save it to file again
This is the File
24 salman 98 97 96 95 94 A ;
21 faizan 88 87 86 83 85 B ;
35 Gohar 99 98 97 96 90 B ;
45 sibghat 91 92 78 85 88 C ;
009 john 89 87 91 78 95 C ;
how can i read data of roll no 35 and modify it and save it again to the file
this is my program
int r = 0 ;
while ( ar[j]!="0" ) {
//cout << "Salman majid is
" ;
if ( ar[j]==k ) {
r = j ;
getdata() ;
[Code] .....
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]....
My homework assignment is to compare the id's of students from least to greatest. How to do this.
// Student Class.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
[Code].....
Working on a project for a c++ class and got a bit stuck.
What I am trying to do is include a class for calculating home square footage in a program I have written for my last project. When I do this, I get errors in codeblocks, on lines 74 and 87, "expected ; before 'box', and 'box' was not declared, respectively. Unsure what my snafu is... I had these two programs separate and both run without errors until I combine the two into one program.
Create an application to manipulate an array of student record objects. A student record will consist of a name (first, middle, and last), an ID number (9 numeric digits, cannot be more or less), an address (street, city, state, and 5 digit Zip code), and a phone number (3 digit area code and 7 digit number). The application will support an array of students. The user will be allowed to enter records from the keyboard, sort records by either name (last, first, middle) or by ID, save the records to a disk file (name supplied by user), and read the records from a disk file (name again supplied by user).
Create a fixed length string that must check that the length of the string is the required length. The fixed length class should be done as a template with the number of characters as the template argument. From this fixed length string, derive a class to hold digits of a fixed length.
Create component classes as necessary to use together to implement the student record class.
Use either the array template created in an earlier lab to handle the array or you may use the vector class from the STL to handle the array of student record objects.
The maximum number of students will be 25 (it may be less).
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] ....
I have been creating this program for a student registration system. For the file handling So far I can write in to a file , view all records, and search a single record. now i got the problem with updating details . my coding is as bellow ..
void file_update() {
int r;
struct student stu;
fstream stu_file;
cout <<"========Update Record======"<< endl;
stu_file.open("student.txt", ios::app );
[Code] ....
My problem is it won't update the record. it just adding a new record.
Assignment on Linked List : Write a program that maintains student academic records using a linked list. The data structure is to be implemented as an array of structures. The fields of the structure are as follows:
• Student ID - this should be unique
• Last name
• First name
• Middle initial
• Course
• QPA
• Address
The program shall be menu driven. This means that the actions that the user can do with the program is govern by choosing an option. The menu shall look like this:
Student Records
1. Add student Academic Record
2. Edit student first name
3. Delete student record
4. View student record (by last name)
5. View all student records
6. Exit
For the edit and delete, the search value should be the student ID. What's lacking on my codes is for the 3rd option. What should I must do with it? These are my codes
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#define M 10
#define FLUSH while(getchar() != '')
[Code] .....
Here is my code ... How to display student with given attributes ...
class student {
private:
int roll_no ;
char name[30];
char phone_no[15];
[Code] ....
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