C :: Gradebook Program - How To Store And Access Data

Jun 15, 2013

How I would store all the data. Also how would I access it after I store it. Side Note we are not allowed to use structures or objects.

For the purposes of this gradebook you should first provide a menu with the following options

-Add a new course Add a new student to a course Add grades for a student in a course Print a list of all grades for a student in a course Print a list of all students in a course Compute the average for a student in a course Compute the average for a course Store Gradebook (to a disk file) Load Gradebook (from a disk file)
-Each of these menu items should correspond to a function you will write.
-For the basic program each student will be represented by an ID number And each course by a course number
-Grades will be whole numbers only (no fractional part)

As indicated in the menu you will need to store and load using a disk file so that the data is retained.

Here are so limiting values in defining your data structures: Maximum Number of students (total) 100 Max number of courses 25 Max number of courses per student 4 Max number of grades per student per course 10

View 6 Replies


ADVERTISEMENT

C++ :: Store Related Data Of Program Into External File?

May 14, 2013

How is it possible to store the related data of a program C++ into an external file (like as .txt) and retrieve it?

I want to write c++ program that can contain data members " id and phone"

like as
Code:
class profile {
private: int id,phone;
public:
void retriever() {
cout<<"Enter your ID: ";
cin>>id;
cout<<"Your Phone number is "<< phone;
};
}

avoiding formats in above class, purpose is to store data already in txt file with different id and phone numbers and it is to be retrieved by matching id number to txt file and viewing its related phone number.

View 1 Replies View Related

C++ :: How To Access Excel File From A Program - Search It For Data And Return Info

Nov 12, 2014

I have been asked to create a program that accesses an inventory file done in excel, look for a alpha-numeric code, which will be inputed by the user, and return to the user informations related to the position of that code, and informations related to the header of the column in which the code resides.

An example of the function I need the program to perform would be:

User inputs: 1429-R1

And the program returns: Marco's 6A, 8/21/2014, 3/7/2014.

using the following example of file:

Marco's 6A
Assessment 8/21/14 3/7/14
1584-R1 1584-R1 1584-R1
1461-2R1 1461-2R1 1461-2R1
1429-R1 1429-R1 1429-R1

View 1 Replies View Related

C++ :: Access Private Data Of Base Class Without Access Modifier

Sep 9, 2013

if we don't provide the acces modifiers for base class and we need to manipulate the private data of base class in derived class. Is there anyway to acces the private data members? Here's a coding example

class A {
private :
int a;
};
class B : public class A {
public :
void displayA() { cout<<a<<endl; }
};

how i can acces the a of base class A in derived class B without acces modifiers.

View 16 Replies View Related

C :: Program That Can Implement Functions That Store / Get And Deletes Text / Binary Data To Given Memory Area

Sep 19, 2013

I got an assignment at school asking for a program that can implement functions that store, get and deletes text/binary data to a given memory area. We are supposed to make kind of like a tiny-mini OS..any links to some tutorials or explanations hon ow to understand this and be able to make a program like this on my own?

View 9 Replies View Related

C/C++ :: Creating Gradebook In A Table

Nov 6, 2014

I'm unable to get the grades to print in the table format, it only takes the homework grades and not the tests and quizes.

// week 8.cpp : Defines the entry point for the console application.
// Gradebook 1.cpp :

/*Rewrite the program "Gradebook 1" to contain 1-dimensional arrays. All information entered or calculated within the program is located in an array. The final output(Class Summary) should contain a summary sheet that contains all of the information in table form. */

#include "stdafx.h"
#include <stdio.h>
#define Size 30//Maximum class size
#define max 100//maximum grade
#define min 0//minimum grade

[Code] .....

This is my result :

Welcome to the Gradebook Program.

Please enter the number of students: 2
Enter the number of Tests to be averaged: 2
Enter the number of Quizzes to be averaged: 2
Enter the number of Homework assignments to be averaged: 2

[Code] .....

View 4 Replies View Related

C++ :: How To Access Certain Elements And Store Multiple Inputs

Jan 20, 2014

am trying to create a program that asks the user personal questions.

std::vector<std::string> name, age, favsinger;
std::cout << "Hello, what is your Name Age Favorite_Singer? ";
std::cin << name; //i want to store the user's info along with the sibling's

[Code]....

View 4 Replies View Related

C# :: Best Way To Store And Load Image Into Access Database?

Dec 12, 2014

I have:

An Access database in which the picture right now is saved by its directory, together with other field like title, publisher, developer,..

Visual Studio form in which a load button gets that directory as text

Details button that reads the ID of a selected item (I have a list of games) and displays the corresponding picture by reading the directory

The problem right now is that once someone else opens the program on his/her computer, the directory changes, making the whole thing useless.

Is there a way to get around this problem? The books I've been reading don't really adress this.

Directory is a string in class 'Game'; it's short text in the database

private void buttonFoto_Click(object sender, EventArgs e) {
LoadNewFile();
}
private void LoadNewFile() {
OpenFileDialog ofd = new OpenFileDialog();

[code].....

View 9 Replies View Related

C :: Store Data In Binary File Then Use It To Find Inverse Of Matrix Form Of Data

Dec 6, 2013

I need to find inverse of a matrix data in binary file should be used to form matrix.its not finding inverse correctly rest is working good.

Code:
#include <stdio.h>
void createbin();
void display();
void inverse();
int main()
{
createbin();
display();
inverse();

[Code] ....

View 4 Replies View Related

C++ :: Add Data To Text Files Which Are Required To Store 3D Scan Data

Jul 10, 2013

I have written the following code to add data to text files which are required to store 3D scan data (I have to calculate the y-coordinate). My code seems to work except that it stops working when I want to create more than ten text files i.e. the directory I am trying to store them in will not hold any more than ten text files. Code is shown below.

#include <string>
#include <locale>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;

[Code] ....

View 1 Replies View Related

C++ :: Best Way To Store Data?

Jul 8, 2013

struct Book{
string bookTitle;
string ISBN;
string author;
string publisher;
string dateAdded;
int qty;
double wholesale;
double retail;
};

What's the best way to store multiple of the above structure?Ideally, it would be with a binary output, but that isn't possible with the strings, unless I'm missing something. So that leaves me with two options.

-Create a second structure that has an outrageous char[] length, and then copy the data from the original structure to write/read to/from the file. The flaws I see in this is excess runtime with copying, and a larger amount of memory is temporarily needed. The positive I see is I can use binary output, which is easier.

-The second option is to just use an ASCII file, and put each element on it's own line, and then just use getline to read each line. The flaw I see in this is that I have to read the file into the structure, instead of just reading the structure and the file can be tampered with (Not a huge concern). The positive is the lack of negative from the above.

View 4 Replies View Related

C/C++ :: BST - Cannot Access Memory Data

Nov 11, 2014

When I return mem add I cannot access the data in that add: in bin search tree

Curr=findMin(root);
cout<<"val: "<<Curr->barcode<<endl;
bst::hwareItem* bst:: findMin(hwareItem*& root){

while(root!=NULL){
root=root->left;
}
return root;
}

View 1 Replies View Related

C :: How Data Actually Store In File

May 19, 2014

How data actually store in the File. Like do data store just in one line or at different places for example in array data store in adjacent memory block while in struct data store at different memory block.?

View 2 Replies View Related

C++ :: Using Arrays To Store Data?

Mar 25, 2013

start writing a program to store some information and then have it recalled. I would like to be able to store a list of the video games I own because i thought it would be fun :)

View 1 Replies View Related

C++ :: How To Store Data Into Array

Apr 18, 2013

How can I store this data into an array?And I only can read the first integer.. 10.... How can I read the whole file...Heres the data:

10 alice 4/23/1972 123-45-6789 support assistant
3 bob 6/7/1980 111-12-1134 logistics manager
1 carol 10/2/1963 987-123-1143 admin ceo
2 dave 10/3/1974 902-22-8914 admin cfo
17 erin 6/13/1991 126-83-1942 technology supervisor
15 frank 2/22/1987 303-12-1122 logistics assistant

Heres what I have so far?

#include <iostream> //Accesses libaries for console input and output
#include <fstream> //Needed to access the fstream object to read files
#include <string> //Needed to access the string class
#include <cstdlib>

[code]....

View 1 Replies View Related

C++ :: SDL Library - Access To Pixel Data

Mar 7, 2013

I am using the SDL library, and came across a way to access pixel data.

//A pointer to a surface structure

SDL_Surface *w = SDL_SetVideoMode(800,400,8,SDL_SWSURFACE);

//Casting a void pointer pointing to an array of memory locations(the pixels), to a pointer to an array of Uint8's.
//SDL_MapRGB() Returns an Uint32 containing the color 0,0,255,(0/255, i think it returns the transparency too, or else it would rather return a Uint24,not sure).

Then modifying the memory location, in this case the pixel at the middle of the window.

static_cast<Uint8*>(w->pixels)[(200*w->pitch)+400]=SDL_MapRGB(w->format,0,0,255);

What i seem to not understand is that, i cast pixels to Uint8*, which means I now have a pointer to an array of 8bit numbers, but SDL_MapRGB seemingly returns an Uint32 or Uint24 for a color composed of r,g,b, together without 'a' is 24bits(256=1b,256=1b,256=1b)=3b.

And then i somehow assign that pixel which is of 8bit at chosen location, an Uint24 or 32bit unsigned int.

How does this work?

View 3 Replies View Related

C++ :: Class Data Member Access?

Jul 5, 2013

I have some doubt regarding class data member accessing in another file.Follwing code showing error.

class A://file a.cpp
{
public:
int add;
int sub;
};
//file b.cpp
extern class A
void cal()
{
A::add=A::sub;
}

View 4 Replies View Related

C++ :: Access To Data Of Array While Have Its Name As String

Jul 31, 2013

The problem is as following. First, I have 21 arrays named: integer abee1, abee2, ... , abee20 and myarray all with the same dimension of [51][4]. Next, in a loop of 20 circles, I fill myarray with random integers then copy it into abee1-20 (each one per iteration). Then, for each array (abee1-20), I want to calculate sum of all numbers in second column as cost of that array and store it in the a new array called arrayCosts[20][2] ( char arrayName, int arrayCost)- the name of array in the arrayName column and cost of that array into arrayCost column . After that, I want to sort arrayName based on the cost and extract the 3 top array with lowest cost. I know that I should do a search in the array to find these three. Finally, copy these three into 3 new array called elite1, elite2, elite3.I do not know what to do.

1-The following code is for making the sting name of abee1-20 in string made in each step of the loop.

for ( cc = 1 ; cc < 20; cc++)
{ string String = static_cast<ostringstream*>( &( ostringstream () << cc) )->str();
string array_name = "abee" + String;

I want to use array_name (for example in the first loop which array_name is “abee1” ) for reaching the abee1 (which is a filled array) after dong a search in the array called “arrayCosts”. This search retrieves the name of array but it is string and I want to have the array with the same name.

View 2 Replies View Related

C :: How To Store Data Structure Into 2D Array

Mar 22, 2013

I have this data store into a data structure.

i j x y w h w*h
0 0 0 0 9 11 99
1 0 0 11 9 10 90
2 0 0 21 9 11 99
0 1 9 0 8 12 96
1 1 9 12 8 7 56
2 1 9 19 8 6 48

[Code]...

Code:

struct data {
//Here
/*! horizontal position */
int x;
/*! vertical position */
int y;
/*! width */
int w;
/

[Code]...

data and then i have an array /*! it contain group_id of each data line*/ int group_id[16]={0,0,0,0,3,3,1,1,1,3,3,2,2,2,2,1}; I never worked with 2D array before. My problem is that i want to create a 2D array of that data for example if i write data[j][i].. It will give me the reference/value of all data lines that belongs to j column, and same with group_id[j][i]. I don't know how i can store these structure vaules in this like 2D array.

View 2 Replies View Related

C++ :: How To Store Data From A Class Into A Container

Feb 10, 2013

I'm having trouble understanding on how to actually store into a container from another class. Any simple example.

View 9 Replies View Related

C++ :: How To Store And Retrieve Data In Class

Aug 20, 2014

I have a class I use to store column data read from delimited text files.

Code:
class column_data {
// class functions here
public:
// initialize class members
column_data()
: header(""),

[Code] ....

Each column is read into the vector of string. Next the string data is copy converted to the vector of double or the vector of int depending on the data type. There can also be additional transformations of the data (normalization, scaling, etc) and the transformed data is copied to the transformed_double_data vector. I do end up with multiple copies of the data, but I can clear some of the vectors if I don't need all the versions of the data anymore. Each column object goes into a container like a vector of objects or map of objects depending on how I need to access the column data.

There are functions that calculate statistics on the data in the columns and the results are assigned to the object variables like validate_r2. There are separate statistics for each column, so it seems logical to store the results in the column object. This works well for statistics like validate_r2 (pearson's correlation coefficient).

The current issue is that I have other statistics like "pw50" that I need to calculate and store. The statistic is the percent within +/- 50 units and the request for pw50 is passed in from the command line. The issue is that there could be several of these and they can have more or less any value like, pw50, pw75, pw100, etc. Storing data like this doesn't fit into my scheme very well because I can't pre-declare a variable to hold the result for every possible option. I don't know in advance how many, if any, of these there will be. I was thinking of adding two vectors, one of string and one of double,

Code:
class column_data {
public:
// initialize class members
column_data()
: header(""),
type(""),
use(""),
validate_r2(0.0),

[Code] ....

For each of this type of statistic requested, I would push_back a label into the string vector and then put the result into the parallel position in the double vector. This seems like I would work, but there are probably some things that could be done with pointers that might be better. Another option would be a vector of objects where each object had a string value for the label and a double for the result. That would be more bullet proof as far as keeping the label and value together, but I have not ever nested objects in a class like that so I thought I would post. I don't know the syntax for declaring an object of class_b inside the definition of class_a. The need is to provide dynamic storage for an unspecified number of these statistics and a reliable way to retrieve the values using the label.

View 1 Replies View Related

C++ :: How Could Object Access Its Private Data Members From Outside

Nov 12, 2013

How does an object access its private data members in copy constructor.

The relevant part of the code: Code: C::C(const C &obj)
{
x = obj.x;
y = obj.y;
}

Normally the object1 called "obj" cannot access its private data members outside. But in this situation it can access. How can it be explained?

Here are the complete code:

Code:
#include <iostream>
using namespace std;
class C{
public:
C(int,int);
C(const C &);

[Code] .....

View 7 Replies View Related

C# :: Access Database Connection And Saving Data

Mar 17, 2014

I want to connect an access database (.mdb) to my Windows Forms application - this I can do and I have no problems viewing my table in server explorer.

Some code example or template that I can use as a base to learn from - I have literally trawled Google and Youtube and cannot find what I am after.

What I want to do is have a basic form, 2 text boxes and a button to save the data to my database.

FirstName and LastName are the 2 boxes.

View 6 Replies View Related

C++ :: Access Violation When Using Pointers To Read Data

Apr 23, 2013

I have the following method to read in a data file using a struct and a doubly linked list.

The readFile method is as follows:

Code:
struct contact *readFile(char * FName,struct contact **ptrList) {
struct contact *head, *newContact;
FILE *fptr;
char oneLine[60];
char *sname, *fname, *phone,*company, *email;

[Code] .....

My struct definition is like this:

Code:
struct contact {
char sname[15];
char fname[15];
char phone[15];
char company[15];
char email[15];
struct contact *prev;
struct contact *next;
};

View 2 Replies View Related

C++ :: How To Store Data By Descending Order Auto

Oct 27, 2014

I wanna store my data by descending order auto without doing a classification after , i have come up with a code but it crashes.

Code:
void list::create(int num) {
struct node * n,*temp;
n=new node;
n->data=num;
if(head==NULL)

[Code]....

I don't wanna use the list library with the push.buck, i need to do it by coding it without fix functions ....

View 3 Replies View Related

C/C++ :: Store Data From A File Into Array Of Structs

Mar 10, 2015

That;s what i have so far: problem: the output data is not correct.

input file
1301 105515018 "Boatswain" "Michael R." CSE 230 ="R01"
1301 103993269 "Castille" "Michael Jr" CSE 230 ="R03"
1301 103993267 "Castille" "Janice" CSE 230 ="R03"

[Code]....

View 1 Replies View Related







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