General C++ Programming - April 2011 (Page 27)

factory pattern
 
class Invoice 8 { 9 public: 10 virtual void print() = 0; 11 Invoice(){cout<<"invoice constructor"<<endl;} 12 virtual ~Invoice()...
[16 replies] Last: [quote=jackel7777] Since p,q are not defined in Invoice class but in t... (by Galik)
Arrays- this gives right answer but after the "Enter score for" part weird numbers come after it and ill show u in the reply
 
#include <iostream> #include <cstdlib> using namespace std; int main () { int score ; int total=0; for(int a=0; a<=4; a++) ...
[3 replies] Last: ok that works, thanks and another question how would i get the average... (by NYCrealist123)
by iSkull
Need some help with prointers to member function
 
i need to create a database of references to specific member functions of different classes, and call all of them trough a function. This is a code example o...
[5 replies] Last: Solved! I used a base class and virtual functions: #include <iostream... (by iSkull)
Playing mp3 with Fmod
 
I would like to create an as simple as possible console program that just plays a certain mp3. I'm using the mingw compiler (in Dev-C++). Fmod is probably the b...
[no replies]
reading any file
 
hi,all I'm new to c++ and I want to read any file byte byte and then get the ASCII code fore each file. I searched in Google and also search this forum bu...
[1 reply] : You might want to check if there is an error on your fstream before tr... (by Galik)
I have no idea of how to create a "class"
 
Hi experts! Can some one help in explaining the step i can take to create class name "Parking" in a parking ticket calculating system, with member function that...
[2 replies] Last: thanks. just trying to get help from all possible corners. (by muham2k)
Help with Airline Seating Assignment (Array)
 
Hey guys, I've been having a bit of trouble with my c++ program i'm trying to create for an assignment. I'm still learning, but array's seem to give me the mos...
[no replies]
Christmas Tree of *
 
I need this output using simple loops. * *** ***** ******* * *** ***** ******* * *** ***** ******* * *** ***** *******
[1 reply] : you had a post yesterday asking how to output * *** ... (by quirkyusername)
I need to show *** insteed of charecture while input
 
hello. this is my code which i am trying to work on int main() { int tries = 3; string acc,password,MainPage,dummy; { while (tri...
[12 replies] Last: so whats the password again ? sorry i am really new to this i did not ... (by ashraful)
Constant Expression error and some other errors
 
I received some errors. I can't seem to find the solution. 1>------ Build started: Project: cse30_lab10, Configuration: Debug Win32 ------ 1> prime.cpp ...
[2 replies] Last: First 5 errors happen because you can only declare static arrays of co... (by hamsterman)
Arrays-this gives an error saying that "passing NULL to non-pointer argument 1 of ‘void srand(unsigned int)’
 
#include <iostream> using namespace std; void arrTest() { int arr ; srand(NULL); for(int i = 0; i < 6; i++) { ...
[7 replies] Last: haha thanks got it now, and thanks to albatross as well (by NYCrealist123)
wxWidgets linker errors.
 
I am currently starting to get into wxWidgets programming. I successfully build wxWidgets, and creating a new wxWidgets project in Code::Blocks works (builds an...
[13 replies] Last: From docs/tech/tn0019.txt here's the note; if "winundef.h" fixed the p... (by stahta01)
proram is possible
 
Is it possible to make a program that automatically takes number and find it's sum, Avg. or show their result ?
[2 replies] Last: enter a number......123 enter a second number......456 sum=579 average... (by buffbill)
loan repayment
 
Monthly installment calculation is (Loan Amount / (12 * number of years of year repayment)) + 7% of (loan Amount) In case the customer forgets to pay the inst...
[2 replies] Last: I suggest you run it out in lotus or excel and then post your code ind... (by buffbill)
Array-error i get is invalid function declaration, need help
 
#include <iostream> #include <cstdlib> using namespace std; int main { int arr ; for(int i = 0; i < 6; i++) { int r = rand() %...
[1 reply] : You need () after main. (by firedraco)
unnamed namespace
 
Say I have an unnamed namespace that contains some functions local to a certain file. Is it posable to declare the functions inside of the namespace and define ...
[2 replies] Last: So I just use the namespace keyword again when defining the function? ... (by ModShop)
resolving collisions
 
Hi all, When making games in the past, I had stored pointers to base class entities in my world and to determine the type of entity when a collision occured I ...
[15 replies] Last: @ultifinitus since I'm not far into the project there is currently n... (by quirkyusername)
Toggle comments hack
 
Hi all, I discovered this by accident and thought that it`s worth sharing. Using the "hack" described below, you can switch between two code parts, by delet...
[5 replies] Last: eh? you change the 1 to 0 to toggle. *cough* Yeah...I uh...knew tha... (by firedraco)
Deleting vector using user input
 
i want to delete items from vector and i want to take user input for doing so.kindly see the BOLD part of code. I want to delete the device and corresponding vo...
[1 reply] : You could use a set =] http://cplusplus.com/reference/stl/set/ (by ultifinitus)
smart pointer
 
how do i use a auto_ptr instead of a simple pointer here; class factory 27 { 28 private: 29 static Invoice* ptr; 30 public: 31 factory(){...
[17 replies] Last: so does that mean that new derived1 and new derived2 will be automati... (by Disch)
April 2011 Pages: 1... 2526272829... 37
  Archived months: [mar2011] [may2011]

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