General C++ Programming - June 2012 (Page 2)

constructor call (1,2)
 
Hello. Why is it that constructor is called just once in the following code? struct widget{ widget(){cout << "ctor called" << endl;} }; widget f(w...
[22 replies] Last: Framework (2534) Jun 27, 2012 at 3:29pm hooshdar3 wrote: "+I got the... (by hooshdar3)
Complex Programming (1,2)
 
I've just learned the basics of c++ basics but all i am able to do is cout numbers and stuff my teacher said that all the programming is done in c++ even in win...
[20 replies] Last: Generally speaking, all generalized statements are wrong. Apart from ... (by closed account z05DSL3A)
how to initialise a vector of vectors with existing vectors ?
 
Hi all, I would like to initialise a vector of vectors with existing vectors, like this : vector<vector<uchar> > vectorOfVector = {mVec1, mEVec2, mVec3}; ...
[14 replies] Last: Great ! I could install gcc-4.7.1 for test. But still, in C64, I ca... (by lalebarde)
Vector Array and Functions
 
So I am trying to pass a deck of cards to a function then the function uses the deck to fill a vector array with people * 3 (3 cards per person and people is th...
[7 replies] Last: Edit: You were right, I forgot the & in the prototype. Thank you (by cgleckman)
libcurl question
 
Has anyone used libcurl much? I'm using it to make a small program that downloads a file from a http site. Having some trouble at the minute, program keeps cr...
[4 replies] Last: Awesome, I've clearly messed it up somewhere then. As I said I'll fix... (by MrHutch)
fgetc returning -1?
 
Hey all I have been working on a tile based game (birds eye view type of thing) and im reading a map from a text file (or multiple). Everything seems fine unt...
[9 replies] Last: I think i may have found the problem, in one of my previous functions,... (by SuperStinger)
Webcam Image Processing
 
Hi there! First post on C++ Forums. :) I am currently a graduating Computer Engineering student and have a certain idea for our senior project which requires...
[14 replies] Last: Check this out guys: http://ahmedorabi.blogspot.com/2011/05/this-wa... (by MarkBadong)
Simulation of Monitoring of Internal Applications&Hosts of a Company
 
In order to do this simulation Will c++ has all the capability. For reference Please check the below URL, Kind of solution i wanted to implement in my project....
[no replies]
Have I understood some OOP concepts correctly?
 
Like if I would want to store a bunch of objects somewhere would I do it somehow like class Object { public: bool Instanced; std::string Name; Object(bo...
[3 replies] Last: Read this: http://www.cplusplus.com/reference/stl/vector/ Example ... (by IceThatJaw)
by Rodan
Trouble reading/storing BMP
 
Hello. I'm trying to write a program that reads in a BMP file and outputs some simple data specs, like height and width in pixels. This is just to make sure...
[1 reply] : // #pragma pack(2) // found this as a 2 byte alignment... no idea wha... (by closed account o1vk4iN6)
Tic Tac Toe Problems
 
Can someone take a look at this and point me in the right direction. I have been having trouble with this for a couple of days now and can't figure it out. I'ts...
[5 replies] Last: Also you should edit checkBoard so that is general for BOTH players. F... (by eraggo)
Overload operator !
 
How can i overload the ! operator? Do you have an example or any references for operators overload? Thanks.
[3 replies] Last: The only rule for overloading the logical negation operator is that th... (by closed account zb0S216C)
.eof() Trouble -- Infinite loop
 
I am trying to read from a file that has a title of a book, number of copies of said book, and then the price. Each item is its own line in the text file. The n...
[3 replies] Last: Thank you so much for the help. I tried different ways to put that for... (by AaronTrahan)
cin buffer problem
 
Ok so I have this problem where if the user inputs two words, only the first word is outputted. I tried solving it by editing my program to the one below, but i...
[2 replies] Last: When you press enter a new line character is added to the stream. cin... (by Peter87)
Equivalent for getch()
 
Hi Would u pls introduce something standard as an equivalent for getch() and getche(), that is something that 1) waits for a single keystroke, and 2) returns a...
[1 reply] : There is no equivalent function in standard C++. (by Peter87)
DWORD Array Length
 
I've tried Google, though I couldn't find any that worked. sizeof don't work here, so how would I find the length? Array: DWORD offsets = {0x378, 0x14, 0x0...
[8 replies] Last: You can if you will pass an array by reference. For example void f(... (by vlad from moscow)
by CMarco
split string
 
I have created this basic examples: #include <algorithm> #include <boost/algorithm/string.hpp> #include <string> #include <vector> string s = "a,b, c ,...
[12 replies] Last: Hi, I was able to solve my question using str.find and src.substr(f... (by CMarco)
by luza
STL find a pointer in vector question.
 
Would anyone know which is the 'best practice' to find a pointer in a vector. i have these 3 solutions: typedef std::vector<CBaseCalculation*> BaseCalc...
[19 replies] Last: Ok, now I get it :D It works because the vector is a subset of all ... (by TheIdeasMan)
string and parsing
 
Hi, I have a problem. If I have a string, for example "(3,4)" or "(8,9)", how can I understand that there are two numbers separated by a comma within two bracke...
[4 replies] Last: there is a little problem! if s="(8,9" (without close bracket), the sc... (by marcoskivo)
by cniper
array fill problem
 
what am i doing wrong here?? i am supposed write a program to write a random number in the range (0,100) in an array. getting error C2440: '=' cannot convert fr...
[6 replies] Last: thank you all. It worked like charm here s the final code #include <... (by cniper)
June 2012 Pages: 1234... 33
  Archived months: [may2012] [jul2012]

This is an archived page. To post a new message, go to the current page.