Search Results

Showing results 1 to 17 of 17
Search took 0.00 seconds.
Search: Posts Made By: minas1 ; Forum: C++ and child forums
Forum: C++ Aug 7th, 2009
Replies: 7
Views: 349
Posted By minas1
Forum: C++ Aug 7th, 2009
Replies: 7
Views: 349
Posted By minas1
You overload an operator when it makes sense to do so.

Say that you create a custom string class MyString.

It makes sense to overload the + operator, but not the ~.
Forum: C++ Feb 8th, 2009
Replies: 12
Views: 625
Posted By minas1
Call the copy constructor.

Let me explain:

Shoe shoe1; // calls the constructor
Shoe shoe_copy(shoe1); // copy constructor
Shoe shoe_copy = shoe1; // copy constructor, even if it seems it's...
Forum: C++ Feb 8th, 2009
Replies: 12
Views: 625
Posted By minas1
shoe_copy=shoe1; will call the assignment operator, not the copy constructor. The copy constructor is called for example when you pass an object to a function by value.

// copy constructor called...
Forum: C++ Dec 7th, 2008
Replies: 8
Views: 990
Posted By minas1
Try darkGDK, it's free and very easy to use. Google it.
Forum: C++ Nov 25th, 2008
Replies: 8
Views: 1,861
Posted By minas1
result is a local variable, which is destroyed when the functions ends. So a garbage value is destroyed. The best solution is to do what is said by the poster above.

If you need to work with...
Forum: C++ Nov 17th, 2008
Replies: 23
Views: 1,457
Posted By minas1
Do you have any book that you learn from?

edit:
the way you did it, it will ask only once for the answer and the program will terminate. In my version it will keep asking until you enter the...
Forum: C++ Nov 17th, 2008
Replies: 23
Views: 1,457
Posted By minas1
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <ctime>
using namespace std;

int main()
{
srand((unsigned)time(0));
int random_integer1 = 1 + rand() % 500;
Forum: C++ Nov 17th, 2008
Replies: 23
Views: 1,457
Posted By minas1
const int ANSWER = random_integer1 + random_integer2;


random_integer1 = (rand()%500)+1;
random_integer2 = (rand()%500)+1;


should be
Forum: C++ Nov 17th, 2008
Replies: 23
Views: 1,457
Posted By minas1
No problem. Post back if you don't get it working.
Forum: C++ Nov 17th, 2008
Replies: 23
Views: 1,457
Posted By minas1
replace these "
cin >> answer;
cout << "\n";

return 0;

} "

with that code. You will need to return 0 and close the brace of course :p
Forum: C++ Nov 17th, 2008
Replies: 23
Views: 1,457
Posted By minas1
int input;
const int ANSWER = random_integer1 + random_integer2;

do
{
cin >> input; // get input
} while(input != ANSWER);
/* this will repeat as long as input is not equal to the answer....
Forum: C++ Nov 17th, 2008
Replies: 3
Views: 624
Posted By minas1
Don't forget to #include <cstring> to use strcmp()
Forum: C++ Nov 7th, 2008
Replies: 12
Solved: New to SDL
Views: 1,329
Posted By minas1
Is it an image you changed manually from .jpg (for example) to bmp by just renaming the file?
Forum: C++ Nov 5th, 2008
Replies: 8
Views: 4,101
Posted By minas1
try static_cast<std::string>(the_LPWSTR_var);

or if it doesn't work


reinterpret_cast<std::string>(the_LPWSTR_var);
Forum: C++ Nov 5th, 2008
Replies: 12
Solved: New to SDL
Views: 1,329
Posted By minas1
Ok.


optimizedImage = SDL_Display_Format(loadedImage);
should be
optimizedImage = SDL_DisplayFormat(loadedImage);
...
Forum: C++ Nov 5th, 2008
Replies: 12
Solved: New to SDL
Views: 1,329
Posted By minas1
Are you sure you added the library files from project settings?
Showing results 1 to 17 of 17

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC