49,757 Topics

Member Avatar for
Member Avatar for disc

When checking my code with PC-LINT it advised me to make some member-functions const What is the advantage of doing this ?

Member Avatar for disc
0
181
Member Avatar for Samran

Hi, I am facing a problem with allocation of two dimensional char array. The problem statement requires me to get the number of rows and columns of the array from a file. I have saved the rows in "rows" and columns in "columns", both of type int. Here is how …

Member Avatar for Samran
0
3K
Member Avatar for thingstealer

Hi everyone, How do you define two structs that include lists of or pointers to each other? I've tried including a forward declaration of one, and neither way works. Any help getting around this would be great, thanks in advance! [code=c++] // struct arc; struct node { Vector<arc> arcs; void …

Member Avatar for thingstealer
0
129
Member Avatar for mguj1130

For this program I am supposed to add two numbers together, up to 20 digits, using arrays...i have most of it working but i cant figure out how to solve the carrying over problem when the two numbers added are greater than 9....here is what i have so far [code] …

Member Avatar for vmanes
0
666
Member Avatar for vmarc29

Hi all, i made some java few time ago and i'm now studying C++ here is a simple program i've been working on to learn about it but the fact is for some days now i can't figure why it doesn't work... in fact i just want to create an …

Member Avatar for vmarc29
0
163
Member Avatar for nosnibor

[CODE=cplusplus] bool BODYTYPE::Seek(BODYTYPE * body) { string line; string key(body->style); size_t found = ' '; fstream file("..\\Data\\BODYTYPE.txt",ios::in); if (!file.is_open()) { cout << "Unable to open file \n"; return false; } file.clear(); file.seekg(0); for(;getline(file,line);) { if((found = line.find(key,0)) == 0 ) { file >> body->style >> body->doorCount; return true; } } …

Member Avatar for nosnibor
0
82
Member Avatar for bluemm87

[CODE=cplusplus] // using pointers with // const methods #include <iostream> class Rectangle { public: Rectangle(); ~Rectangle(); void SetLength(int length) { itsLength = length; } int GetLength() const { return itsLength; } void SetWidth(int width) { itsWidth = width; } int GetWidth() const { return itsWidth; } private: int itsLength; int …

Member Avatar for StuXYZ
0
160
Member Avatar for johnray31

Hi guys, I am trying to learn this fantastic language. My question is Does Structure in c++ contain default constructure and destructure. And when we allocate memory for structure by new operator like Struct special { int x; int y; }; special = new special; Then if special going to …

Member Avatar for Comatose
0
99
Member Avatar for Dendei

Hello i have an array of dates and want to input a week ex week #14 and get all the dates written out in that week. Anyone know a good way to convert weeks to dates or how i should solve this? thx for answer.

Member Avatar for Dendei
0
94
Member Avatar for Seapoe

Hi, I'm new here and need some help on beginning my program. I've read the thread on homework help and am not here asking for someone to do my program. I have an assignment which I basically have to take in polynomials from the user and add/multiply them. I decided …

Member Avatar for monkey_king
0
102
Member Avatar for fourstar

Hi all, I'm new here. Hello! I am a new comp. sci major and am required to take a beginning course which we learn c++. So far I've been hanging in, but I don't have the greatest teacher to learn from. I've had no formal programming language training. I've actually …

Member Avatar for mvmalderen
0
333
Member Avatar for rickster11

a percent sign? My program asks the user for a percentage rate. It then puts (with cin) the rate into a double. However...if a user tries to type a % after he enters a number...the program goes wack...

Member Avatar for mvmalderen
0
176
Member Avatar for Vallnerik25

I have a question regarding when to use delete to free memory used by a pointer. I have a class function that uses dynamically allocated memory and I want to properly use delete to free up the space when I am done with it. [code=c++] // Overloaded addition operator. CSimpleString …

Member Avatar for Vallnerik25
0
236
Member Avatar for dvsConcept

I'm trying to simulate the spin of a slot machines [reel1][reel2][reel3] so they look like they are in motion. i'm getting this error: Error 2 error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion) [code=c++] //rotation of …

Member Avatar for dvsConcept
0
690
Member Avatar for jayli27

[code=cplusplus] #include<fstream.h> #include<stdio.h> #include<conio.h> #include<string.h> #include<iostream.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> void deposit(void); void addrecord(); void delrecord(); void modrecord(); void disprecord(); void dispall(); void withdraw(); float w,z; class account { int accountno,cls; char name[30],type; float deposit,withdraw; public: account() { deposit=withdraw=0; } int giveaccountno() { return accountno; } void getdata(int …

Member Avatar for siddhant3s
0
361
Member Avatar for VBNick

right now, I am allocating a dynamic 2D array for my rasterizer's edge list. My setup looks like this: [code="cplusplus"] struct EDGE { float x, dx; float uvws[4]; //u, v, 1/z, shade float duvws[4]; float y_limit[2]; bool active; }; struct EDGERECORD { EDGE *left_edge; EDGE *right_edge; EDGE edges[9]; UINT16 num_edges; …

Member Avatar for VBNick
0
138
Member Avatar for BruenorBH

I am creating a program in Dev-C++ v. 4.9.9.2 using Win32 API that loads from a file and saves to a string. The only issue is that I cannot split the string to the requested variables... Here is what is in the file... 08:00:00 PM, 08:00:00 PM, 08:00:00 PM, 08:00:00 …

Member Avatar for BruenorBH
0
111
Member Avatar for wrxhokie

I have a C static library that I need to link to a new DLL i'm creating. I'm using Visual Studio 2005, and created a console application that outputs a DLL. But when I try to compile I get unresolved external linker errors: Error 2 error LNK2019: unresolved external symbol …

Member Avatar for wrxhokie
0
323
Member Avatar for freddan007

Hello, I've started learning how to make simple GUI programs in cpp using theforgers tutorial. However I was going to add XP style to my program and I found a page that showed me exacly how to do it for VC++ 6. The problem when I had added the lines …

Member Avatar for freddan007
0
748
Member Avatar for ahfrey85

Hi, while doing my assignment im somehow stucked somewhere which i didnt know why and i need some help. i have jus started learning abt c++. so im jus using some basic syntax [code] #include<iostream> using namespace std; int main() { int selclass,i,position; char ch; int seats[100]={0}; //array while(true) { …

Member Avatar for ahfrey85
0
121
Member Avatar for erialclaire_238

Newbie here. i need to create a program with this output: Enter 5 values: 3 4 5 7 9 Enter a number to search: 4 4 found in location 2 Anyone who can help me on this? Tnx, Claire

Member Avatar for skatamatic
-1
97
Member Avatar for bluemm87

I'm trying to learn C++ with a book and it has this example program in it, but when i try to compile it, it comes back with error C2065: 'localVarable' : undeclared identifier. What's wrong with it? [code=cplusplus] // allocating and // deleting a pointer #include <iostream> int main() { …

Member Avatar for bluemm87
0
74
Member Avatar for risa

How can i prevent a dialog closing by Alt+F4 ? I am using PreTranslateMessage(),,,,what is the Virtual key #define for Alt+F4 or is there any other way?,,,,thank you

Member Avatar for mitrmkar
0
245
Member Avatar for crewxp

For some reason, I can't get scanf to work. I did it just like the book said. Try it. I'm supposed to enter (FirstInitial)(LastInitial)Grade Ex: TB100 For Tom Brady got a 100. It reads: FirstInitial: NOTHING LastInitial: T Grade:0 Then it skips to the second student and did this FirstInitial: …

Member Avatar for siddhant3s
0
290
Member Avatar for 10Pints

Just started using this compiler - with my old VC6 code, but it seems to think a directory is readonly when it isnt? - any ideas? this is at/after the last the line of the file compiler output: c:\data\dev\cms\3.0.0.0\code\word\src\word.cpp(220) : fatal error C1083: Cannot open include file: 'c:\data\dev\cms\3.0.0.0\code\word\src': Permission denied

Member Avatar for 10Pints
0
245
Member Avatar for serkan sendur

hi guys, i wonder if there is technically any difference between using break or return in order to quit a loop without reaching its condition?

Member Avatar for Narue
0
1K
Member Avatar for vicky_dev

Hi, I need a control my native application written in C++ that provides a functionality similar to the SplitContainer control of .NET (System.Window.Forms.SplitContainer). I couldn't find any native control that does the job. Can I get such control or do I have to write it myself? Thanks in advance

Member Avatar for vicky_dev
0
91
Member Avatar for joejoe55

Been working on this little thing for a few months now, having some issues with some structs. This compiled correctly in vs 2003 but doesnt work properly in c++ 2005. (Most of this is others work and open sourced stuff) Any help is appreciated with why I ths doesnt work. …

Member Avatar for mitrmkar
0
188
Member Avatar for billchow24

For example, I have an input text file like a labyrinth I use the array[x][y] to storge each charater in the labyrinth When i start at the top left hand corner, i need to go out to the exit at the bottom right hand. There are two paths as indicated …

Member Avatar for DemonGal711
0
280
Member Avatar for ronicasingh

Hello guys, Does anyone know how to keep a console window active till the user presses any key on the keyboard to close the console? Everytime I create a program on devcpp, when I run it the console window just doesn't stay there, it disappears within seconds. I knew how …

Member Avatar for Freaky_Chris
0
186

The End.