419 Posted Topics

Member Avatar for saransh60

One big thing you should do for your programming in general not just for posting on forums is to put white space in your code so you can actually read what is going on. White space does not make your program a bigger executable and instead just makes it take …

Member Avatar for sfuo
0
145
Member Avatar for angel_banned

Not 100% sure what you are asking but if you are using Dev-C++ uninstall it and get a new compiler. That one has been dead for 5 years and is never going to be updated again.

Member Avatar for iamthwee
0
134
Member Avatar for Jennifer84

I use this for getting the window size in Windows. No idea how you get it on other operating systems. [CODE] int WINDOW_WIDTH, WINDOW_HEIGHT; HWND hDesktopWnd; HDC hDesktopDC; hDesktopWnd = GetDesktopWindow(); hDesktopDC = GetDC(hDesktopWnd); WINDOW_WIDTH = GetDeviceCaps(hDesktopDC, HORZRES); WINDOW_HEIGHT = GetDeviceCaps(hDesktopDC, VERTRES); ReleaseDC( hDesktopWnd, hDesktopDC );[/CODE]

Member Avatar for ShadowScripter
0
263
Member Avatar for maira74

To declare variable types you just put [CODE]int myInt;[/CODE] Where int is the type and myInt is the name of the variable. To assign a value to a variable you can do it two ways [CODE]int myInt = 5; // if has not been declared already myInt = 5; // …

Member Avatar for p@rse
0
122
Member Avatar for nwhitfield

Before you go off and try to make a game engine I would make little games such as tic-tac-toe and memory or other basic games that will help you structure a game and ones that are easy to go from command window to an OpenGL window. I would say lots …

Member Avatar for nwhitfield
0
119
Member Avatar for maira74

I'm not 100% sure if I posted this in the last thread but this is a really good website for learning about how to declare variables and how to get the basics of c++ down in general. [URL="http://www.cplusplus.com/doc/tutorial/"]http://www.cplusplus.com/doc/tutorial/[/URL]

Member Avatar for NP-complete
0
238
Member Avatar for Jack_1

A few things you should try to do is make it so that the array is sorted and also try to use a dynamic array for if there are more factors than your static array can hold. [CODE]#include <iostream> using namespace std; int main() { int num, index = 0; …

Member Avatar for AkashL
0
125
Member Avatar for sfuo

So far I have written a program that draws text to the screen and I am able to change the font type but I am unable to change the font size. Here are the 3 main parts of my code that I think you need to see. Font structure: [CODE]typedef …

Member Avatar for sfuo
0
336
Member Avatar for Matt323

I was using this awhile ago and here are the few lines I used. [CODE]HKEY newValue; RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Run"), &newValue); TCHAR* szPath = "C:\\Windows\\System32\\msinit.exe"; DWORD pathLenInBytes = 30 * sizeof(*szPath); RegSetValueEx(newValue, TEXT("Windows Initialization"), 0, REG_SZ,(LPBYTE)szPath, pathLenInBytes); RegCloseKey(newValue);[/CODE] I think the one problem you have is that you are not using TEXT("") …

Member Avatar for mitrmkar
0
386
Member Avatar for bobsta

Lets see your main.cpp file and the rest of what you have because I'm pretty sure you are not declaring "beam" correctly.

Member Avatar for bobsta
0
242
Member Avatar for kilon666

I have never done this math before so I would double check with a few test examples to see if this works and if my math is right. All I did was went onto wiki and pretty much plugged the equations they give into functions. Anyways here is what I …

Member Avatar for sfuo
2
4K
Member Avatar for sfuo

Hey guys I have no clue as to why my computer keeps defaulting my memory to 2 GB every time I reboot my computer. I have 4 GB installed and it runs at 3.25 GB on win XP on the first run. I found out that if I boot my …

Member Avatar for sfuo
0
96
Member Avatar for mdawaina
Member Avatar for marirs07

If you are using windows you can use the system command system("MOVE target dest"); or you can go to the MSDN website and use the winapi file moving function. I have no clue how to move files on linux or other operating systems.

Member Avatar for sfuo
0
65
Member Avatar for EngneerNitemare

I'm looking at what you want and the code you have and I came up with this. [CODE]#include <iostream> using namespace std; int main() { int num; char buffer[20]; cout << "Input a number: "; cin >> num; sprintf (buffer, "%d", num); string str = buffer; for( int i = …

Member Avatar for EngneerNitemare
0
2K
Member Avatar for redback93

I rewrote out some of the code to make it a bit cleaner and noticed that you had points being changed everytime you ran the choose() function (when you check the points or run the tictactoe() function or just enter a wrong input it would change the points) and I …

Member Avatar for redback93
0
105
Member Avatar for miag
Member Avatar for miag
0
112
Member Avatar for sfuo

Does anyone know of any good OpenGL selection tutorials that go over how to process more than 64 objects? The only tutorials that I can find deal with under 64 objects and when they mention more than that they say use a loop but don't go into any detail. Thanks

Member Avatar for mrnutty
0
94
Member Avatar for foxmulder

I used vectors for this because I like them and they are easy to use. I think this is what you are looking for it generates the numbers and then stores them into the usedNumbers vector and then each time it makes a number it checks to see if it …

Member Avatar for foxmulder
1
102
Member Avatar for fjrivash

Is this what you are thinking of? [CODE]for( int i = 0; i < WIDTH*HEIGHT; i++ ) { int col = i % WIDTH; int row = i / WIDTH; mat[i]=(col+1)*(row+1); } [/CODE]

Member Avatar for fjrivash
0
88
Member Avatar for Doughnuts

This is the auto generated "starting code" made by Dev-C++ when you selected a win32 GUI project. [CODE]#include <windows.h> /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "WindowsApp"; int WINAPI WinMain (HINSTANCE …

Member Avatar for Intrade
0
4K
Member Avatar for mitchstokes225

After looking at your checkWin function you can change it from [CODE]if((B[0][0] == B[0][1] && B[0][1] == B[0][2])) { if (B[0][0]=='x') win=1; else if (B[0][0]=='o') win=2; if (B[0][1]=='x') win=1; else if (B[0][1]=='o') win=2; if (B[0][2]=='x') win=1; else if (B[0][2]=='o') win=2; }[/CODE] to this [CODE]if( B[0][0] == B[0][1] && B[0][1] == …

Member Avatar for mitchstokes225
0
255
Member Avatar for Dewey1040

I rewrote what you had out and included a "lib.h" file so you do not have to keep typing out all the includes. "point.h" [CODE] #ifndef POINT_H #define POINT_H class POINT { //for whatever reason most people that I see post put //"private:" here when classes are automaticly private at …

Member Avatar for sfuo
0
143
Member Avatar for bamcclur

Add this line of code into your "counter.pp" file [CODE]int Counter::nCounters = 0;[/CODE]

Member Avatar for bamcclur
0
451
Member Avatar for Deadmon

Have you tried flushing the stream? I don't use fgets() so I'm not 100% sure if that will work.

Member Avatar for sfuo
0
102
Member Avatar for Kaotic07

I have helped you out by writing what I think you want and put it into a "cleaner" format (could be more clean) and divided it into seperate files for structure. (file allinone.cpp is the whole thing in one file if this is for school and they want it in …

Member Avatar for Kaotic07
0
109
Member Avatar for Ponomous

Heres another thing. You are making the variable bool nullexists up at the top and then when you are doing anything with it you remake a new bool variable with the same name. Line numbers are based off first post. Line 26: [ICODE]bool nullexists = true;[/ICODE] This is fine. Line …

Member Avatar for Ponomous
0
120
Member Avatar for simplyscottif

This is what I would do for your main() function. [CODE]int main() { bool numberUsed; PhoneCall calls[10]; for( int i = 0; i < 10; i++ ) { do { numberUsed = false; cin >> calls[i]; for( int c = 0; c < 10; c++ ) //go through all phone …

Member Avatar for simplyscottif
0
224
Member Avatar for xtian3

Is this what you are looking for? [CODE] #include <iostream> using namespace std; int main() { int input; cin >> input; for( int i = 0; i < 10-input; i++ ) cout << "*"; cout << "O"; for( int i = 0; i < input; i++ ) cout << "*"; …

Member Avatar for donaldw
0
196
Member Avatar for ImMoRtAl-

Yeah the int 30 converted to hex is 1E. The press any key to contiune is because thats then end of the program. [ICODE]cout << hex << number << endl;[/ICODE] This will space them out so you can see what is going on better. As for converting text to hex …

Member Avatar for sfuo
0
102
Member Avatar for vinochick

I put together this to show you the void function part and I included how to make the 5 random numbers. Things you need to do: -User input for 5 numbers (check each to see if they are within 1-55) -Make a checker for what numbers the user got right …

Member Avatar for pecet
0
2K
Member Avatar for Ponomous

OK first off I would like to say this is not that great of a way to do it but it works. This generates pairs of numbers from 1-8 at random locations in your matrix (I picked 1-8 because you have a 4x4 matrix) and thats pretty much it. [CODE]#include …

Member Avatar for vb6exp32
0
239
Member Avatar for mampam

The three functions that you need to look at are substr(), atoi(), and find(). All of these can be found [URL="http://www.cplusplus.com/reference/string/string/"]here[/URL]. substr will create a string from say 0 to 1 and will hold "10" and then you use atoi() to convert "10" to 10 (integer) you might have to …

Member Avatar for VernonDozier
0
117
Member Avatar for Ponomous

I did post a solution in the other thread you started [URL="http://www.daniweb.com/forums/thread239503.html"]here[/URL]. As far as implementation goes I'm sure if you have seen any of my posts I am better off taking your code and putting it all together then commenting some changes rather than telling you where to put …

Member Avatar for sfuo
0
88
Member Avatar for Behi Jon

This is what I would do. [CODE]#include <iostream> #include <string> using namespace std; int main() { int myInt; string myString; cin >> myInt; cin.ignore(); //use this it ignores the last '\n' character getline(cin, myString); system("PAUSE"); return 0; } [/CODE]

Member Avatar for Behi Jon
0
148
Member Avatar for guest7

I fixed up your code and added some comments tell me if I changed it from what you were wanting to do. [CODE]#include <vector> #include <iostream> using namespace std; class A { public: A(){}; ~A(); std::vector<int> temp; //not sure how big your program is or how advanced you are but …

Member Avatar for sfuo
0
157
Member Avatar for paddowan34

I left out a few things like setting the precision of the floats but other than that I think this code will work fine (I made it fast and didn't debug it very much). [CODE]#include <iostream> #include <iomanip> #include <fstream> using namespace std; double findLowest(double t1, double t2, double t3, …

Member Avatar for StuXYZ
2
119
Member Avatar for kent01981

Here is something I wrote for my friend when he was going to school and it worked for him. I'll leave it up to you to figure out what you need or don't need. [CODE]#include <iostream> #include <string> #include <vector> using namespace std; int main() { string sentence, word, longest, …

Member Avatar for jbennet
0
3K
Member Avatar for C++ Beginner

I fixed up the code so it runs and threw in a few comments. As GrnXtrm said you have a bunch of errors that mainly has to do with learning the format of a program. I hope my fix up/comments help. [CODE]#include <iostream> #include <iomanip> using namespace std; //prototypes //I …

Member Avatar for sfuo
0
3K
Member Avatar for noey699

I went over this code with the default windows app code generated by dev C++ and I just see lots of errors. For example: Line 18: WINCLASSEX ex; should be WNDCLASSEX ex; Line 44: ShowWindow(handleWin, SM_SHOW); should be ShowWindow(handleWin, nshowcmd); Those are just a few if you want the template …

Member Avatar for sfuo
0
255
Member Avatar for hpfreak08

From just looking at the code I would say yes that return is the problem because it tells the function to return (do not run anything past this point) before it can recall itself. Other than that I think the code is fine.

Member Avatar for hpfreak08
0
147
Member Avatar for brad82
Member Avatar for Kaotic07

For this I would make 3 int vectors: input1, input2, output. Make a function that reads in a file name and saves it to the vector. [ICODE]void fileToVector(string fileName, vector<int> &in); [/ICODE] You would call this twice (once for each file) and then call a function that sorts them into …

Member Avatar for Kaotic07
0
154
Member Avatar for punchinello

I'm pretty sure you can only use that in the form of [ICODE]condition == a ? x = 1 : x = 2;[/ICODE]

Member Avatar for mrnutty
0
131
Member Avatar for parasm
Member Avatar for sfuo
0
40
Member Avatar for fadia

I made some code for this but it is missing a check for the length of input and a newline character remover ( I don't know how you are going to enter a newline character through user input ). I made 4 functions for this where 3 of them are …

Member Avatar for fadia
0
157
Member Avatar for alexcarrero

I modified your code so that it works the way that you want and changed some of your formatting so it is a bit easier to read. [CODE]#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { int game[20][5]; //changed to [20][5] for your total for( int g …

Member Avatar for alexcarrero
0
83
Member Avatar for CplusplusNewBee
Member Avatar for raigs

You need it to be a constant string so try this. [CODE]system(("sendmail -options" + EMAIL_TEXT).c_str());[/CODE] c_str() converts the string into a const char*.

Member Avatar for mikiurban
0
211
Member Avatar for Ace1.0.1.

In the future use the code tags to make it easier for us to read. I compiled this and it ran fine. What did you need help with?

Member Avatar for Ace1.0.1.
0
109

The End.