General C++ Programming - January 2011 (Page 17)

Find all the sequences of integers that the sum equal the number s
 
With a positive integer s read from the keyboard, find all sequences of 2 or more consecutive integers whole sum is equal to s.For example if s is 15,there are ...
[1 reply] : // try this #include <iostream> #include <conio.h> using namespa... (by asay)
by declan
Forward declaration with default parameters
 
Hey everyone. I have a class that I have split up into a .h file with the function declarations and a .cpp file that has the actual definitions. But what is the...
[2 replies] Last: Thanks! (by declan)
Simple text file reading
 
I want to read text file(.txt) line by line in c++. each line contains instructions like copy(m,n) inc(n) this instruction can be of many times. if in...
[1 reply] : Hi. Excuse me, I didn't understand your question exactly. But if you... (by majidkamali1370)
by lluoc
Reserving memory for **
 
If I have a ** (specifically a int ** in a header file) and I want to reserve memory for it (in a constructor), how would i go about doing it so that the data i...
[2 replies] Last: Dammit, i should have thought of that. Thanks (by lluoc)
Can we prevent function overloading?
 
Hi, one of my friend ask me simple question but did not have answer. can be prevent doing function overloading in c++?
[5 replies] Last: haha, foiled AGAIN! seriously though, I never even thought about do... (by closed account 1yR4jE8b)
functions vs function objects
 
Can anyone explain,seeing that their implementation is quite similar when should we use function objects and when friend functions?
[12 replies] Last: [quote=western] 10 11 12 13 14 class ABC { public: std::... (by blackcoder41)
Object Bytes
 
Hi. How can I print bytes of an arbitrary object? I don't know anything about it's size. for example object is a class or a struct that I defined it. For Exam...
[3 replies] Last: It works with simple data types, and if he wants to change the endiann... (by PiMaster)
fixed
 
fixed
[1 reply] : You do know that Wikipedia has example C++ code, right? http://en.w... (by PiMaster)
by fhg38
Inherited constructor gets confused with copy constructor
 
If I uncomment the line below I get this error message in VC++ 2008: error C2664: 'TestObject3::TestObject3' : cannot convert parameter 1 from 'int' to 'con...
[6 replies] Last: Thanks, it does indeed say this the tutorial, I must have thought I sa... (by fhg38)
by primes
reads ten numbers and prints the largest and smallest numbers entered.
 
#include <iostream> using namespace std; int main() { int count; double num; cout<<"please enter ten numbers "; count = 10; while(count<num)...
[4 replies] Last: Improvable but simple version. (Requires you have the WANOP.h file ins... (by Kyon)
Heap corruption while freeing memory
 
I have following code in which I am getting "Heap corruption detected" message while trying to freeing memory allocated using strdup(). #include <iostream> ...
[4 replies] Last: HOw can we check whether memory is allocated or not? You can't (at l... (by ne555)
singelton object and resource deallocation ??
 
Hi, I am using classical singelton pattern in C++ for a class (using a private static pointer to class instance within the class). Now, I am unsure about the...
[3 replies] Last: Thankyou so much for your kind replies. I was mainly interested in... (by enliten)
by Icenel
ASCII in array
 
printf("%c", 6); out put is Spade Symbol card I don't know this ascii or not. if you have a better way to print this, please let me know. then I want ...
[1 reply] : char spadedeck = { "2\6", "3\6", "4\6", ... ... (by Duthomhas)
Histogram issues
 
Hello I've written a program that makes the user input positive numbers, and a negative number. The negative number tells the program that the user has stopped ...
[1 reply] : Output one asterisk std::cout << '*'; . Repeat it n times. To read... (by ne555)
Encoding Headaches... and JNI
 
Hi people, I am having trouble with an encoding issue. Through JNI (java native interface), I receive a const char* with the path of a file, which I suppose ...
[4 replies] Last: Thanks Duoas!! I just resolved the problem thanks to your advices. ... (by supertreta)
Passing by reference, returning an object
 
Hi everyone, in the code below, 1. and 2. show how I'd like to be using my function.. and 3. shows the way the compiler will let me. Is there any way to use ...
[3 replies] Last: Thanks for the insight simeonz. The reason for the overkill: The re... (by thomas430)
by fat321
page by page
 
hi my friends i want show my program output page by page, because it is too long. how i do it? thanks
[1 reply] : http://www.cplusplus.com/forum/general/34144/ (by king214)
Regarding Histogram - confused
 
I need help with my code, what i'm trying to accomplish is when the user using my program marks a student and gives them "X" amount of marks it'll print a star ...
[4 replies] Last: Thanks mate. (by Deadmau6)
by fat321
page by page
 
hi my friends i want show my program output page by page, because it is too long. how i do it? thanks
[2 replies] Last: \\random code cout << "press enter to goto next page" << endl; ci... (by king214)
by Bv202
Multidimentional array
 
Hey, I know you can assign values to a mutidimensional array this way: int numbers = { {1, 2, 3}, {2, 3, 4}, }; The declaration of my array in d...
[4 replies] Last: So you really have to assign them one by one? Ok, thanks :) (by Bv202)
January 2011 Pages: 1... 1516171819... 24
  Archived months: [dec2010] [feb2011]

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