234 Topics

Member Avatar for
Member Avatar for nicholas.buckley.14

I have to write a program that accepts data for a class and then ouputs it in the main. so far i have this. #include<iostream> #include<string> #include<fstream> using namespace std; ifstream infile; class animal { string species; string family; string phylum; string desc; static int count; public: bool readIN(const string …

Member Avatar for rstralberg
0
314
Member Avatar for jongiambi

Hi so I have a practice lab I am working on where I am asked to fill in the code. The program is supposed to take in two 3D points (x,y,z) and compute the distance between them. I have almosty all of the program finished im just stuck on how …

Member Avatar for rubberman
0
842
Member Avatar for sivate
Member Avatar for sephzy

Hey there, Just hit a road block in my assignment. I won't concern you too much with the assignment itself but it's basically a number input operated menu with option's like "Display employee details" & "Input pay details." I'm up to a part where I need to get the section …

Member Avatar for JamesCherrill
0
326
Member Avatar for TIM_M_91

Ok So I have two classes that share the same instance variables, the variables have been declared in 'Dog', however I cannot seem to get the instances to work within my other class 'DogChorus'. Therefore what must I do to get the instances to work within 'DogChorus' constructors? The variables …

Member Avatar for skatamatic
0
245
Member Avatar for anisha.silva
Member Avatar for jongiambi

The question asks: Write and compile a C++ program that simulates the arrivals of airplanes at Regina airport. An airplane is represented using a C++ struct. Each plane belongs to an airline, such as United, and records the city from which it is arriving, for example Chicago. The airport is …

Member Avatar for WaltP
0
292
Member Avatar for krystosan

Hello, I want to know and understand how and when do we need to implement classes in our code, I have written a program in python just using functions but never feel the need of using classes, so I was thinking when we can create something without classes why do …

Member Avatar for krystosan
0
189
Member Avatar for mkaynutty

So I'm trying to right a code to output some simple data using classes. Everything works accept the retail price function. It's suppose to calculate and output the retail price but it only outputs 0 no matter what numbers I eneter. Can anyone give me some suggestions on how to …

Member Avatar for Ancient Dragon
0
181
Member Avatar for jongiambi

I am trying to implement a function sameMonth from a class to compare two user entered months. My class is declared in a header file "Date.h": #include <iostream> using namespace std; class Date { private: string month; int day; int year; public: Date(); Date(string aMonth, int aDay, int aYear); void …

Member Avatar for vijayan121
0
284
Member Avatar for jongiambi

Can anyone help me with this constructor problem? In main: instantiate one date object (date1) using the default constructor just to see that the constructor works, print the month, day, and year of date1 using the getters get input from the user and use the setters to set the values …

Member Avatar for jongiambi
0
401
Member Avatar for Dendei

hey i have a question how do i get my funktion to work in the design.cs? namespace Visma_projekt { public class BlackJack { public string[] Cards = new string[51]; public void SkapaKort() { System.Console.WriteLine("Ehhhh"); } } } i want to call the funktion from this code visma.cs into the form1 …

Member Avatar for Dendei
0
98
Member Avatar for jeets1892

Hello, Please take a look at the below code - #include<iostream> #include<ctime> // for the time() function #include<cstdlib> // for the srand() and rand() functions using namespace std; int compInput; int userInput; int die1 = 0; int die2 = 0; int Dice () { // set the seed srand(time(0)); // …

Member Avatar for jeets1892
0
2K
Member Avatar for DeHF

I need a little bit of help here. I'm new to C++ Classes. There are some errors which I do not know how to troubleshoot. The error of "Declaration terminated incorrectly" for line 6 and 7. Multiple errors of "Type name expected". Why is that? Multiple errors of "Declaration missing …

Member Avatar for WaltP
0
311
Member Avatar for Pyler

Do you need to implement a class in order for an object to access the class's functions/methods? When should you implement a class? When shouldn't you?

Member Avatar for rubberman
0
339
Member Avatar for Pyler

Could some one point out what's wrong with the classes of this program? #include <iostream> using namespace std; class box { private: int height; int length; int width; public: box();//constructor int surface_area(); int volume(); void set_dim(int ,int, int); }; //implementation box::box(){ int height; int width; int length;} box::int surface_area(){ int …

Member Avatar for WaltP
0
2K
Member Avatar for joshmac

Ok, so I finally was able to convert my framework to the PSR-0 standards, but now I am getting errors in the sample application that I have not been getting before. I am not sure why, so I need a fresh pair of eyes. Any help is greatly appreciated. The …

Member Avatar for joshmac
0
211
Member Avatar for Pyler

I wanted to write a simple program that uses classes but I've been running into errors. Anyone have a clue as to what is wrong with my code because I can't seem to figure it out. #include <iostream> #include <iomanip> #include <cmath> using namespace std; class cone{ private: double radius; …

Member Avatar for Rashakil Fol
0
248
Member Avatar for tandex

some people say that multiple inheritance in java is not needed because we have interfaces or that using singular inheritance can bring the same results as using a multiple inheritance. But that is not the case. Lets take a look at the example I call “The Workbench Example” say we …

Member Avatar for stultuske
0
407
Member Avatar for kace91

Hello to everyone! This is my first post here, I hope you can help me. I'm making a class work in python and I'm a little lost: I have to use classes to represent monomials and polynomials, and the classes should contain methods to add, substract, multiply and divide them. …

Member Avatar for TrustyTony
0
2K
Member Avatar for ObjectOriented

It's useless. Why are stupid classes in C++ having private members for? [snip] I am never using OOP in C++ I'm just using structs to organize data fuck OOP and classes it's so ridiculous to me that I'm SMH

Member Avatar for Divyab
-1
304
Member Avatar for niceyout

hello i am creating a tictictoe game , however i cannot get the program to check if the player has won or not . and produce a you have won message #include<iostream> #include"110ct.h" using namespace std; class TICTACTOE { CursorController*crs; ColourController*cl; int xplayer ; int oplayer; colour Cs; public: void …

Member Avatar for niceyout
0
156
Member Avatar for mehdimughal

This code is supposed to respond on (w,s,a,d and q) key press..... On "w" the character ( actually the $ sign ) should move up similarly s =down , a is for left and d to move right.......... and 'q' is to quit!! Sometimes on a very few (beginning key …

0
97
Member Avatar for justinfritz

I am having trouble with this part of my program assignment. I have created and compiled the three separate implementation files that design the three classes, they each have a default constructor, overloaded constructor, and a display function. //************************************************************************************************************ "When your program is working correctly, define an array of pointers …

Member Avatar for Saith
0
311
Member Avatar for enkitosh

Hi. I'm making a shooting game and since my code was getting a bit messy and big I decided to divide it into couple of classes and files. I'm confused of how to correctly split these files and classes up though. As I imagine it without really knowing if that …

Member Avatar for Serapth
0
360
Member Avatar for zios007

Yes, I know that this is homework. But I need help. This is code the teacher gave us few days ago. This is a header file. And I needed to do the following: My problem is that I didn't know how to use my vecetor in my .cpp file. How …

Member Avatar for sergent
0
135
Member Avatar for Griff0527

I am getting an error during the build stating: "Illegal call of non-static member function" and I cannot figure out 1) what does this mean, or 2) how to resolve it. For detailed clarification, I will type out what the assignment was (I say was because the assignment was due …

Member Avatar for raptr_dflo
0
369
Member Avatar for shywolf91

Here is my code: [CODE] #include <iostream> #include <string> #include <cstring> using namespace std; //() char openedP='('; //open ( char closedP=')'; //close ) //end () //dash char dash='-'; //end dash class PhoneNumber { int countryCode; int areaCode; int number; char type; int year; public: PhoneNumber() { countryCode = 43; areaCode …

Member Avatar for Topi Ojala
0
161
Member Avatar for Chuckleluck

Hello, Suppose I have a chess game. I make a nice class to handle an entire player's pieces: [CODE]class c_ChessTeam { private: // all pieces derive from class c_ChessPiece c_Rook Rook[2]; c_King King; c_Queen Queen; c_Bishop Bishop[2]; c_Knight Knight[2]; c_Pawn Pawn[8]; public: . . . };[/CODE] But what if I'm …

Member Avatar for mrnutty
0
180
Member Avatar for Jetster3220

I am really struggling with a Python classes project. Here are the directions Design and implement a class called Dog that contains attributes (data) representing the dog’s name and age. Define the Dog constructor to accept and initialize that data. Include one method that will reset the dog’s age, one …

Member Avatar for Gribouillis
0
228

The End.