49,757 Topics

Member Avatar for
Member Avatar for daviddoria

Say you have a class that has members [code] private: double a,b,c,d,e,f,g,h,i; [/code] You can make an accessor like: [code] double operator[](int index) { if(index == 0) return a; else if(index == 1) return b; else if(index == 2) return c; } [/code] But how would you do something like …

Member Avatar for Narue
0
96
Member Avatar for Kaotic07

Hello again, I'm having trouble with a program that I have to write involving classes and arrays. Essentially i have to create a class Theater, which I am not sure how to do. The theater has 15 rows with 30 seats per row, and each row is assigned a price …

Member Avatar for Kaotic07
0
105
Member Avatar for duke.tim

this is a simple example of a problem I have been having with differing programs, i am using linux ubuntu 9.10 and codeblocks 8.02 . this is the code [code] #include <iostream> using namespace std; int main() { int hiya; cout<<"hello world \n"; cin.get(); cout<<"enter a number \n"; cin>>hiya; cout<<"you …

Member Avatar for Nick Evan
0
260
Member Avatar for maverick405

I wonder if anyone can tell me how the code tags works? As per my understanding does it works like: [CODE]MY CODE HERE.....[/CODE] for the enitre block of code? or I need to do this for every line of code?

Member Avatar for maverick405
0
228
Member Avatar for nunchuckie

Hi, I've just started with c++ and I have no clue how to do this. Right now I have a code that just printing out the text lines in my file and how many lines there is just to check that i can read from my file... But what I …

Member Avatar for rahul8590
0
135
Member Avatar for FrozenSnake

I decided to try Visual Studio 2010 express Beta 2. This code works fine on my other computer that uses Visual Studio 2009 Pro. I am going to make a Timer that count down from a fixed time depending on foodsource. But first this code need to work :P so …

0
61
Member Avatar for abdelhakeem

Hello All ,This is me again :icon_mrgreen: I'm Making a programme which tell the user to input the name of the product he wants to show its Price and Amount ,but i have a problem: Here's The Code [CODE] #include <iostream> #include <conio.h> using namespace std; struct Shop { int …

Member Avatar for abdelhakeem
0
104
Member Avatar for SagarSonu

Hello All, I am creating the array of size: 26627664 bytes then convert the byte to char array. While deleting the array i got an code gaurd log error that Bad Parameter. I am doing like this Char* pBuffer = (Char*)new BYTE[26627664]; and deleting like this, if(pBuffer != NULL) delete[] …

Member Avatar for Narue
0
107
Member Avatar for maverick405

The code below runs fine but I want some help how can I get output of my original input and reverse of that i.e. ABCDE Z. WXYZ ---> EDCBA .Z ZYXW The below is the code for this. [CODE] #include <iostream> #include <cstring> using namespace std; void swap(char& a, char& …

Member Avatar for Narue
0
81
Member Avatar for abdelhakeem

Hi all, This is me again ,I want to learn programming in ASP.NET using C++ I've installed the IIS ,and made an .aspx file with the following code: [CODE]<%@ Page Language="C++"%> <html> <head><title>Welcome!</title></head> <body> <p align="center"><font color="RED" face="Snap ITC" size="12pt">Welcome to your New ASP.NET Page <br> "Using C++"</font></p> </body> </html>[/CODE] …

Member Avatar for abdelhakeem
0
190
Member Avatar for tarakant_sethy

Hi, some time back i faced question like this. we ca use factory design using factory desing implementation. we can do the same using the shared laibrary, like we will have a static function in the shared laibrary which will be returning pointer to base class object. what is the …

Member Avatar for Narue
0
69
Member Avatar for Ponomous

so i guess there must be some sort of an error in my logic but on line 119 i started a counter that only goes up when a pair is made in the game. Since there are a total of 8 pairs, i set that when the counter is 8 …

Member Avatar for Ponomous
0
118
Member Avatar for new programer

Hello everyone; I did a program using arrays -for the first time- I've got errors, I fixed some and there are others left that I couldn't straighten any help is highly appreciated here is the code : [CODE]# include <iostream> # include <iomanip> using namespace std; int read_car (int cars[], …

Member Avatar for Intrade
0
92
Member Avatar for thebeast91

I have been writing a program using arrays and strings.Here is my question. A class of students takes a 20 question multiple-choice exam;each question has 5 choices(a,b,c,d,e)only one of them are correct.In "tests.dat"Each record of which consists of a student id, followed by a blank, followed by students 20 responses. …

Member Avatar for thebeast91
0
102
Member Avatar for EngneerNitemare

Can someone please explain the concept behind bubble sorting a vector step by step? I know this is a tedious task so whoever answers I will much appreciate it! :) Questions: 1.) What variables are being used? 2.) How and where is the function placed? 3.) Where and why are …

Member Avatar for Nick Evan
0
58
Member Avatar for Tales

I'm making a project in Visual studio 2008. The details of the project are: - It is a MFC Application - The application type is Dialog based with Use HTML Dialog enabled - The project style is MFC standard and... - The use of the MFC is in a shared …

Member Avatar for Tales
0
227
Member Avatar for simplyscottif

Design a PhoneCall class that holds a phone number to which a call is placed, the length of the call in minutes, and the rate charged per minute. Overload extraction and insertion operations for the class. Overload the == operator to compare two PhoneCalls. Consider one PhoneCall to be equal …

Member Avatar for simplyscottif
0
217
Member Avatar for xtian3

this is the output when enter 1 *********O* when enter 2 ********O** ---------------------------- 1*********O* 2********O** 3*******O*** 4******O**** 5*****O***** . . . . . . . help me plss tnx

Member Avatar for donaldw
0
157
Member Avatar for bigmaq

So i need help figurin out where my segmentation fault is comin from. Im not even close to finishing this program but i was just testing my progress so far to make sure that it was taking values correctly, but sometimes the program doesnt stop when its supposed to and …

Member Avatar for bigmaq
0
89
Member Avatar for ylchen

Hi all, I'm new to working with C++ (I'm more a C programmer) and I have a question: I have a container class for a templated type T, which could be any scalar type, although the most commonly used ones are unsigned char and float. I have a function that …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for Mr.PinkBunny

I've been studying VC++ for about 2 months, and I was working on my first game from a book (Game Programming All In One) The game is 'Craps', it's a dice game. Anyways, I've had a few prolems with the codeing, can someone help me? (Windows 32 Console) Here is …

Member Avatar for Tales
0
182
Member Avatar for confusedndazed

Pseudocode is still somewhat confusing and I've been reading and this assignment for the a while now and I wanted to make sure I am understanding what's being asked of me. Could someone please tell me if my pseudocodes are correct? Question: 1. Using pseudocode declare a Real number named …

Member Avatar for Tales
2
99
Member Avatar for the great

hello i have given a program which uses the class. It reads the date of birth. And do all the necessary checks on the given value. e.g. What is the limit of that particular month, whether it is a leap year or not. I am writting the first program using …

Member Avatar for Clinton Portis
0
95
Member Avatar for red999

I recently needed to add member functions like these into my class [CODE]istream& read(istream&) ; ostream& print(ostream&); [/CODE] I am a little confused on how to actually call these functions within my class. I am more familiar with overloading the insertion and extraction operator since the prototype for those makes …

Member Avatar for red999
0
246
Member Avatar for bpt0004

My program deals with the Genetic Algorithm and Hill Climber Algorithm. I have a program that compiles without any errs, its just the data is gives is incorrect. I explain my error on the bottom part of my post Header File [CODE]#include <iostream> using namespace std; //------------------------------------------------------------------------------ template<class T> class …

Member Avatar for Vash32291
0
108
Member Avatar for kkevin

Hi everyone!! I am Kevin, and I am new to this site. I am taking C++ classes and have trouble writing this program. I know I have to use several "for" loops and "rand" commands to write it but i am not exactly sure how to do that?? so, please …

Member Avatar for Narue
0
63
Member Avatar for Rapmanseele

cout<<"hello,everybody!"; Can somebody come for the rescue? Please *My_problem(Is writing a fuction that divides two polynomials ) { return rescue; }

Member Avatar for Narue
0
48
Member Avatar for ImMoRtAl-

Please ok can any one give me the code to this im making a program and it needs this and im stuck please give code asap application that will convert any text I throw at it to hex Thank You

Member Avatar for sfuo
0
99
Member Avatar for Privoxy

Good morning all, So i have started teaching myself C++ in preparation for taking software engineering at university next year, after many hours i have managed to put a simple program together, Im just asking if someone can tell me on in the right track to understanding what each function …

Member Avatar for Narue
0
84
Member Avatar for reese27

I have a project that requires me to make a search engine for classes. If i were to enter Biology, then classes such as genetics, chemistry, anatomy and physiology are to show up. But the thing is i have the classes and their descriptions in a file and i was …

Member Avatar for donaldw
0
109

The End.