General C++ Programming - February 2014 (Page 21)

create .bmp file
 
Hello there, I now have a file with X, Y, Z and Intensity (0-1) of all the pixels. I want to create a .bmp file (grayscale) with this information in C++. Can...
[1 reply] : There are two ways to do this. a) Study the BMP file format and the... (by Catfish666)
static variables !
 
Hello, it's very simple but I don't know how to do. How can i receive in output 1,2,1 ? I need to create a class I so that output is 1,2,1 with that main. Tha...
[7 replies] Last: Ah, right, yes - well-spotted, Disch! I wasn't paying attention to th... (by MikeyBoy)
SDL (C++) Paint Program
 
Hello, I'm attempting to make a Paint program, and my main problem is that I cannot seem to get the paint to "stick" . What I'm doing is this: 1) Draw...
[3 replies] Last: On which surface should I draw the "brush" that moves with the mouse?... (by Disch)
by Jexen
Noob here, basic C++ problem, need help
 
Wont let me upload photos here so i uploaded it onto the photo sharing site Imgur. Looking for some help with this question, i might just be over-thinking it...
[no replies]
To call a class method/function from a .hxx file in a .cpp file
 
How do I call a class method which is defined in a .hxx file separately to a .cpp file? Is it any different from how we normally do it (using the scope resoluti...
[1 reply] : if you want to define it in the cpp file, then you should use the scop... (by nvrmnd)
Coplexity of the algorithm
 
Hi All, I have been reading about evaluating the complexity of algortihms, etc..etc..though I am very good at math and probability I never understood a bit of...
[7 replies] Last: Hi All, Thanks a lot for clear and concise clarfications...These post... (by venkatacplpl)
Checking Dynamic Memory Cross-platform
 
Suppose: cin >> number; pointer = new type[number + (rand()%number); So, I wont know the memory allocated for pointer. How can I check it in all OS?...
[4 replies] Last: @long double main I need to track it. I'm preety sure that is OS depen... (by iQChange)
by parsap
Delete an object in multi-thread situation
 
I have to delete an object at a time that I don't know it's held by another thread(s) or not. For example static void foo(CLASS* ref){ pthread_mutex_lock(...
[2 replies] Last: Sounds like a job for std::shared_ptr. Would you please give an exa... (by parsap)
Why is my output wrong?
 
I'm trying to write a program that shows the output of the summation formula from k=0 to n C_(n+1)= ∑ C_(k)*C_(n-k). Here's my code #include <iostream>...
[1 reply] : You have only initialized the two first elements in the array. (by Peter87)
by leo255
Using a struct/char array for Tic Tac Toe Game
 
Hello, I spent my entire winter vacation basically taking a 5-unit Calculus class (in 5-weeks) for over four hours a day, every day of the week, so I'm a littl...
[1 reply] : #include <iostream> typedef char board_type ; bool check_win( con... (by JLBorges)
How to make a Derived Base Dependent?
 
I have a class Base (abstract, with pure virtual) and Derived (which inherit Base). I use this: Base* A = new Derived(); But I can do this: Derived ...
[4 replies] Last: Thanks. Solved :). (by iQChange)
End program by pressing enter key?
 
I'm trying to end my program when the user presses the enter/return key. I'm trying to do this with a break statement. I have two different situations, one w...
[3 replies] Last: Either read in a complete line, and use s string stream to extract whi... (by JLBorges)
Write a program that reads a string and outputs the number of times each lowercase vowel appears in it.
 
What i am doing wrong.. #include <iostream> #include <string> using namespace std; int vowelsNumberof (string, char); int main() { string str; ...
[1 reply] : Please use code tags. http://www.cplusplus.com/articles/jEywvCM9/ Fr... (by Austin J)
Skips a Step
 
#include <iostream> #include <string> #include <cstdlib> using namespace std; //Class function class MovieData { private: string title; string dire...
[1 reply] : Please don't double post. http://www.cplusplus.com/forum/beginner/123... (by giblit)
Continue statement in nested loop
 
Hello, I was wondering how I could use a continue statement that continues in a nested loop. For example if I have for (int i=0;i<amount;i++) { for (int...
[5 replies] Last: Don't use goto, just to exist from a loop. Some say never use goto at... (by kbw)
Mathematical fomula in C++ windows32 application
 
Hello, I am writing a program to calculate the scores for a decathlon and I am having trouble applying the numbers to the formula. The formula is (points = A*...
[1 reply] : http://www.cplusplus.com/doc/tutorial/operators/ (bitwise operators) ^... (by ne555)
Iteration strange output
 
Hey guys, this code works perfectly fine if n is 0 or 1, except for the fact that when it is any higher, at the end of every output is the square of x . This...
[8 replies] Last: Well that works lol. The program runs just like I'd want it to now. Th... (by fizanimtiaz93)
Random matrix
 
I am trying to create a random 3x3 matrix and print it out in a text file using basic functions. My code below will not compile and I can not figure out why. An...
[2 replies] Last: I forgot to add "cout << endl;" between the two for loops. Thank you f... (by Binarydude87)
passing 2d array created using <vector> --simple example
 
Hello, I am trying to pass a 2D array called f (coming from a text file with 9 columns of numbers and 297,680 rows) that was created using the vector container...
[5 replies] Last: Got it. Thanks a lot! (by adamsheimat)
counting vowels
 
so question is to count the # of vowels and print it out. But my answer keeps saying '0' #include <iostream> #include <iomanip> using namespace std; int ...
[4 replies] Last: You can also wrap your entire code in a while loop, which should solve... (by Smac89)
February 2014 Pages: 1... 1920212223... 33
  Archived months: [jan2014] [mar2014]

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