C++ :: Transform Program To Program Using Class

May 15, 2014

I have my program to load info about students from .txt file

Mrkvicka Jozef 2 1.75 2.1 0.4 1 0.49 1.27
Hrasko Jan 0.1 0.38 1 1.2
Mladek Peter 1.6 0.4 2 1.3 1.8
Petrzlen Robert 0.6 0 1.1 1.1 0.6 0.59
Horvath Ivan 1.6 0.8 0.7 1.3 1

My program is ruuning perfectly only problem is that i must transform it to program uses class, class student . Am very beginer in using classes, so far i do very easy programs using classes.

so far i have this

#include "stdafx.h"
#include "student.h"
student::student(vector<STUDENT> studenti) {
vStudent=studenti;

[Code] ....

I try to make it but its too difficult for me. in that student.h and student .cpp is 50 errors..

Here is my code

#include "stdafx.h"
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <fstream>
using namespace std;

[Code] ....

View 13 Replies


ADVERTISEMENT

C++ :: Memory Usage Of A Program With CLASS And Without CLASS?

Nov 6, 2014

I developing a C++ Program to deal with huge data computation. I am using Pointers to hold the data during computation. Current program i developed without using CLASS.

I would like to ask that will the memory usage will be reduced and computational time will be shortened if I modified my program implementing the CLASS into it ?

View 1 Replies View Related

C Sharp :: Use A Program To Add New Class?

Nov 30, 2012

Whether it is possible to add a new class to a program? For example: program a is my main program and I want to use program b to just add a new class to program a.

View 5 Replies View Related

C++ :: How To Use The Operator In Class Template In Program

Apr 25, 2013

I have a list of numbers in an array created by a class template

Code:
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
const int CAPACITY = 20;
template <class T>
class A

[code].....

View 2 Replies View Related

C++ :: Errors While Writing Car Class Program

Oct 9, 2013

Ive been writing this code all day and these errors have been killing.

Instructions:
Car Class:
Write a class named Car that has the following:
year. An int that holds the cars model year.
make. A string object that holds the make of car.
speed. An int that holds the cars current speed.

In addition, the class should have the following member functions.

Constructor. The constructor should accept the car's year and make as arguments and assign these values to a object's year and make member variables. The constructor should initialize the speed member variable to 0.

Accessors. Appropriate accessor functions should be created to allow values to be retrieved from an object's year, make, and speed member variables.

accelerate. the accelerate function should add 5 to the speed member variable each time it is called.

brake. The brake function should subtract 5 from the speed member variable each time it is called.

Demonstrate the class in a program that creates a Car object, and then calls accelerate function five times. After each call to the accelerate function, get the current speed of the car and display it. The, call the brake function five times. After each call to the brake function, get the current speed of the car and display it.

Errors: error C2061: syntax error : identifier 'stringm'
error C2533: 'Car::{ctor}' : constructors not allowed a return type
error C2511: 'Car::Car(int)' : overloaded member function not found in 'Car'
see declaration of 'Car'
fatal error C1903: unable to recover from previous error(s); stopping compilation

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

[Code].....

View 2 Replies View Related

C Sharp :: Make A Program Without Using Class

Apr 22, 2012

Is there any way or trick to make a program that executes without using any class or class concept

View 4 Replies View Related

C++ :: Class DayType That Implements Day Of Week In A Program

Aug 15, 2013

Write the definition of the class dayType that implements the day of the week in a program. The class dayType should store the day, such as Sunday for Sunday. The program should be able to perform the following operations on an object of type dayType:

a. Set the day
b. Print the day
c. Return the day
d. Return the next day
e. Return the previous day
f. Calculate and return the day by adding certain days to the current day. For example, if the current day is Monday and we add 4 days, the day to be returned is Friday. Similarly, if today is Tuesday and we add 13 days, the day to be returned is Monday.
g. Add the appropriate constructors

Write the definitions of the functions to implement the operations for the class dayType.

My code:

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
string my_Day[7] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
class dayType

[Code] .....

And here are the error messages that I get:

Line 23 error: prototype for 'void dayType::setDay(int)' does not match any in class 'dayType'
Line 11 error: candidate is: void dayType::setDay()
Line 36 error: prototype for 'void dayType::getDay(int) const' does not match any in class 'dayType'
Line 13 error: candidate is: void dayType::getDay()

I know this is probably a really easy mistake but I am new to Programming and I have changed this code for days to no avail.

View 2 Replies View Related

C++ :: Class Objects - Program Not Comparing Two Strings

Jun 20, 2013

I am having difficulty with class objects.

1. why my program won't actually compare the two strings.
2. why and where I am having a memory dump crash.

The following is my main.cpp, String.cpp, and the header file in that order.

#include <iostream>
using namespace std;
#include "GREEN_String.h"
void main () {
GREEN_StringStr1;
GREEN_StringStr2 ("AdrianGreen");

[Code] .....

View 5 Replies View Related

C/C++ :: Writing Program For Class Where User Enters Their Age?

Aug 18, 2014

I am writing a program for a class where the user enters their age, how much money they have, and their full name. I know that I have to use the getline method to get the user's full name, and I know that I have to use cin.ignore() before that code, but i'm not sure why I have to use cin.ignore()?

View 1 Replies View Related

C/C++ :: Employee Payroll Calculations Program For A Class

Sep 30, 2013

getting output from my code when I compile, the codeblocks ide doesnt show any errors it just doesn't give me any out put when I compile?

Here is my code:

#include <iostream>
#include <string>
#include <iomanip>  
using namespace std;  
//
//CLASS DECLARATION SECTION

[code].....

View 1 Replies View Related

Visual C++ :: Converting Program From Struct To Class

Sep 20, 2014

I am not exactly sure how to do this and i keep running into problems. This is my code here that works.

Code:
#include<iostream>
using namespace std;
struct record {
double quiz1;
double quiz2;
double midyear, midyear_one;

[Code] .....

View 5 Replies View Related

C :: Write A Program To Display Class Schedule To User

Apr 20, 2014

I'm new to coding, and I have to write a program to display a class schedule to the user (the classes are entered into the program in strings like this:

Code:
course Calculus3 = {80934,"MATH",11,"Calculus 3","Edward Turner","M,W",950,1100}; )

in the format of an excel file (the user picks the classes they want to have) that then displays the course title and professor in the correct cell corresponding to the day/time the class meets. I've been googling it, and from what I've read, I think I need to use a csv file, but I don't know how to input the data into the file. I know the general format for how data is entered, but I don't know how to write it into a specific file or if I even have to (we covered txt files very briefly in my class, but never touched csv files).

View 3 Replies View Related

C++ :: Creating Infix To Postfix Program Through Inherited Class

Apr 25, 2014

I have the following problem on my C++ Program and I am not sure why it is not working. I am creating a infix to postfix program through an inherited class which I am not sure it is working.

#include <iostream>
#include <stack>
using namespace std;

int in_stack_Priority(char a){
if(a == '*' || a == '/')
return 2;

[Code] .....

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

C++ :: Rectangle Class Program - Header File Will Not Compile

Mar 7, 2014

I am currently learning OOP, and I can't figure out what the problem is with my header file. The rest of the program complies fine though. I am using g++ on UNIX.

myClass.h:9:23: error: Rectangle.h: No such file or directory
myClass.h: In function ‘int main()’:
myClass.h:13: error: ‘Rectangle’ was not declared in this scope
myClass.h:13: error: expected `;' before ‘rect’
myClass.h:14: error: ‘rect’ was not declared in this scope

Code:
myClass.h
/* This header file contains, The main function for my rectangle class program.*/

#include "Rectangle.h"
using namespace std;
int main(){
Rectangle rect;
rect.displayMaxRectangles();
rect.process();
rect.summary();

[Code] .....

View 1 Replies View Related

C++ :: Program To Calculate Fine Using Class - Calling Constructor

Sep 7, 2013

// Program to calculate fine using class.

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
class library {
long bookid;
char bookname[25];

[Code] ....

In the above program, how do I call the diff. constructors in main?

View 5 Replies View Related

C++ :: Build A Banking Simulation Program Around The BankAcct Class?

Sep 5, 2014

I'm supposed to build a banking simulation program around the BankAcct class, which provides the following service: create new account with unique account number (maximum 5 accounts created in a single test running); deposit/withdraw; print information of all existing account. I was running a test program with only 2 services first, namely creating new account and depositing, but the program just keep on crashing and I couldn't figure out why.

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

[Code].....

View 1 Replies View Related

C++ :: Write Program For Class That Reads From Input File?

Mar 7, 2013

I am trying to write a program for class that reads from an input file the month, year & total collected. I am using notepad for the input file.

This is what the notepad file looks like
-----------------------------------
March 2013 63924.62

Why does it give me random numbers in the output rather than what the notepad has?

Also, the outfile is completely blank.

#include <iostream>
#include <iomanip>
#include <fstream>

[Code].....

View 2 Replies View Related

C/C++ :: Repeating Errors On Overloading Non Member Class Program

Oct 21, 2014

I am having a issues with an assignment in my class and don't really understand why. I am getting undeclared identifier errors even though I have declared and I am also getting an error. Here is the code:

#include "stdafx.h"
#include <iostream>
#include <cassert>

[Code].....

Last time I came to you all with an error it was a simple brain fart on my part but I don't think this one is like that. I would love to tell you what the program is supposed to do but I still do not really know, which might be part of the problem. I guess it outputs different sized rectangles...

View 7 Replies View Related

C++ ::  basic Polymorphism - Parent / Child Class Based Program

Oct 19, 2014

I am making a very basic parent/child class based program that shows polymorphism. It does not compile due to a few syntax errors reading "function call missing argument list. Lines 76 and 77, 81 and 82, and 86 and 87.

#include<iostream>
using namespace std;
class people {
public:
virtual void height(double h) = 0;
virtual void weight(double w) = 0;

[Code] ....

View 4 Replies View Related

C++ :: Sorting Program That Uses Variables From Another Class - List Not Declared In This Scope

May 13, 2014

I've got this sorting program that uses variables from another class but I'm not sure why its not recognizing it. I'm getting an error length and list not declared in this scope.

#include <iostream>
#include "arrayListType.h"
using namespace std;
template<class elemType>
class orderedArrayListType: public arrayListType<elemType> {

[Code] ....

View 1 Replies View Related

C++ :: Use Class Structure To Create Program That Reads In Two Rational Numbers?

Nov 4, 2013

how to use a Class structure to create a program that reads in two rational numbers and adds them, subtracts, multiplies, and divides them.

View 3 Replies View Related

C++ :: Program That Will Represent Axis-aligned Right Triangle In X-y Plane As A Class

Apr 10, 2013

I am having trouble of exactly how "class" works. I dont know what the difference between set and get is. I have this code:

#include <iostream>
#include <cmath>
using namespace std;
class Point {
private:
double px;
double py;

[Code] .....

How to get void Triangle::setBottomLeftX(const double x) to work.

Implement the get and set member functions for the class Triangle. Use the appropriate class attributes of the class Triangle.

a. The location of the bottom left vertex is stored in the member attribute blPoint.
b. The top left vertex can be computed from blPoint and the height.
c. The bottom right vertex can be computed from blPoint and the length.

View 19 Replies View Related

C/C++ :: Program To Compute Length Of String Entered By User By Class

Sep 30, 2014

I want this program by using only iostream.h & conio.h

View 4 Replies View Related

C++ :: Transform XML To TXT

Apr 14, 2015

This is how my .xml page looks in a web browser. Is there a way to transform my .xml file into .txt file so that the text file would look like this?

View 14 Replies View Related

C# :: Transform Seconds Into HH:MM:SS?

Jun 18, 2014

I am trying to transform seconds into HH:MM:SS. I thought it would be easy using the TimeSpan functions however my hours exceed 24 hours now and then therefor it is not viable for use.

private string getFormattedTimeFromSecond(double second)
{
TimeSpan t = TimeSpan.FromSeconds( second );
string answer = string.Format("{0:D2}h:{1:D2}m:{2:D2}s",
t.Hours,
t.Minutes,
t.Seconds);
}

This is what I have tried, however it does not like it much when hours exceed 24.

View 6 Replies View Related







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