2,712 Posted Topics

Member Avatar for himgar
Member Avatar for nateuni

[QUOTE=Narue;961959][B]>So if you did mean well.. and even if it came out in a bent, skewed >and poorly communicated way, well thank you I do actually appreciate that.[/B] Too little, too late, and wording it like your misunderstanding is [I]my[/I] fault. It's a wonder you have any friends at all. …

Member Avatar for mrnutty
0
214
Member Avatar for MaestroRage

I think what you are looking for is something like this : [code] char *twoDee[][3] = {{"item1", "1", "1"}, {"item2", "1", "2"}}; [/code] You need to supply the column before hand. Thus the code : [code] char *p[][] = {{"item1", "1", "1"}, {"item2", "1", "2"}}; [/code] Is an error because …

Member Avatar for MaestroRage
0
97
Member Avatar for eggowaffles

The AI should do something like this : 1) Check if you can move if the middle 2) Check if you can win in 1 move 3) Check if player can win in 1 move 4) Check if opposite corners from user is available 5) Check if any move is …

Member Avatar for mrnutty
0
148
Member Avatar for chelseagoo

"im facing the problem on how to use the ctime random,for loop and array " Seems more like your having problems using Google, let me help [URL="http://www.google.com/"]YOU[/URL]

Member Avatar for mrnutty
0
255
Member Avatar for vivekarora

Look around and observe. They are everywhere. Trees, board, water, foods, wall, most of which seems to look like fractals.

Member Avatar for mrnutty
0
122
Member Avatar for Der_sed

Your cin.get doesn't work because it read the newline character. use another cin.get().

Member Avatar for mrnutty
0
155
Member Avatar for blsnls

cin does not read white spaces. use cin.getLine(...), or cin.get(...) or getline(...); They don't skip spaces.

Member Avatar for mrnutty
0
85
Member Avatar for vivekarora

how about a pure virtual destructor. Also [URL="http://www.gotw.ca/gotw/031.htm"]gotW[/URL]

Member Avatar for vivekarora
0
188
Member Avatar for crys0011

[QUOTE=Ancient Dragon;488140] printf() beats the pants off cout every time. [/QUOTE] In what, user-friendliness? cout and cin are much more safer than printf. Most of the time cout is easier to format than printf; In my opinion of course. I see that you are a c guy?

Member Avatar for mrnutty
0
127
Member Avatar for logine

Hint1 : use a for loop. Hint2 : if your up to it, use recursion. Hint3 : Google oggle it

Member Avatar for mrnutty
0
93
Member Avatar for almasari

[QUOTE=almasari;962419]come on. i want find the answer[/QUOTE] The answer is within you my child. Just unleash it!

Member Avatar for mrnutty
0
93
Member Avatar for ScienceNerd

if(condition) { do this } else if(another condition) { do this } else if(another condition) { do this } else { do default }

Member Avatar for tux4life
0
143
Member Avatar for shadwickman

1) Unless your compiler supports the keyword [I]export[/I], you have to provided the template header and its definition in the same file 2) Here is a example : [code] #include <iostream> #include <ctime> using namespace std; template<typename Type> class Example { private: Type var; public: Example(Type T); //see definition below …

Member Avatar for shadwickman
0
167
Member Avatar for gretty

Also, from experience. I see that using 2D array to store information from a file does not always work well. The program might not set the file content it to proper location. I would suggest to use 1D array. If 2D is really needed , then use 1D array, and …

Member Avatar for mrnutty
0
123
Member Avatar for muzhe
Member Avatar for muzhe
0
170
Member Avatar for scantraXx-

don't know or don't care on why you are reading the same file twice, if i understand correctly, but to answer your question, reset the file pointer to the beginning after reaching the eof(), by using similar to this code : [code] ifstream inputFile("toBeOrNot2Be.doc"); inputFile.seekg(0,std::ios_base::beg); [/code]

Member Avatar for tux4life
0
195
Member Avatar for plongx211

Haven' you tried something? Give some idea you might have on how to go about this.

Member Avatar for tux4life
0
105
Member Avatar for DavidDan

Perhaps use windows.h if your OS is windows. [code] #include<iostream> #include<windows.h> using std::cout; using std::cin; using std::endl; int main() { _SYSTEMTIME st; GetSystemTime(&st); cout<<st.wMonth<< "\\" << st.wDay <<"\\" << st.wYear<<endl; } [/code] or [URL="http://www.cplusplus.com/reference/clibrary/ctime/mktime/"]google[/URL]

Member Avatar for tux4life
1
226
Member Avatar for nokiolurv

1) sort the data 2) count frequency of each data 3) find max number of frequency 4) return that number or index to that number

Member Avatar for mrnutty
0
94
Member Avatar for infinity16
Member Avatar for ellla

Use [URL="http://www.cplusplus.com/reference/stl/list/begin/"]iterator[/URL] provided by list.

Member Avatar for mrnutty
-1
133
Member Avatar for xfreebornx

Compare and contrast (sorting wise) : [code] #include<iostream> #include<vector> #include<ctime> //for time.h #include<algorithm> using namespace std; struct Info { int id; char gender; Info() : id(0) , gender(' ') { } Info(int i, char g) :id(i), gender(g) { } }; bool sortByID(const Info& a, const Info& b) { return ( …

Member Avatar for xfreebornx
0
549
Member Avatar for vijay4vin
Member Avatar for gretty

change to [code] void enterPurchase(float pur[][25], float nWeek, float counter); [/code]

Member Avatar for Salem
0
143
Member Avatar for Awebb999

Although inefficient I will suggest you a way. [code] void rot(int *a, int sz) { int * t = new int[sz]; t[0] = a[sz-1]; for(int i = 1; i < sz; i++) t[i] = a[i-1]; for(int i = 0; i < sz; i++) a[i] = t[i]; delete [] t; } …

Member Avatar for mrnutty
0
86
Member Avatar for azjherben

[code] cin >> hex; //set the input stream to read in hexadecimal long num = 0; cin >> num; //input a number, example 15 cout<<hex<<showbase; // shows output as 0xsomeNumber cout << num; //prints 0xf instead of 15 [/code] you can do the same with ifstream iFile("number.txt") or ofstream oFile("numbers.txt"); …

Member Avatar for mrnutty
0
299
Member Avatar for AssaultM16

your function prototype is declared like so : [code] //accepts 2 string not 1 or 3. int name(string a, string name1); [/code] [code] cout<<"And what is yours?"; getline(cin,name2); name(name2); //you call it with 1 paramter, or 1 string [/code] Look below : [code] string name1 = "jack"; string name2 = …

Member Avatar for mrnutty
0
99
Member Avatar for kharri5

You could just use glPush/Pop Matrix. Makes it much easier. 1) draw sun say at (0,0,0) 2) draw earth at the same position as the sun 3) Translate earth to some radius 4) Now using glRotate on the earth would rotate the earth around the sun. 5) use glPushMatrix() /** …

Member Avatar for mrnutty
0
522
Member Avatar for kernel>panic

I'm sorry but I don't know where to begin. Your program needs indentation, and spaces. Its unclear. It uses system commands. Its uses goto commands all over the place. you allocate 900000000+1 memory twice and never delete it. Your encrypt and decrypt program is way out of hand. Your program …

Member Avatar for mrnutty
0
155
Member Avatar for Okimdone

The compiler complains because you need to initialize const int a. Const variable are static binded by computer, so you cannot change its value during runtime. If the above code was allowed then you would be able to const variables during runtime. And this would violate const data variable's purpose, …

Member Avatar for kvprajapati
0
89
Member Avatar for BlackPhoenix

Here is a sample app via openGL. [URL="http://rapidshare.com/files/259197210/Land_.zip.html"]Terrian[/URL] 1) Press ',' the comma key to get a outline view. 2) Press space bar about 15 times or so, to displace the land. 3) press 'c' to smooth out the land. Its one of my earlier project.

Member Avatar for mrnutty
0
125
Member Avatar for glahh

There is a std::sort, and std::unique function. That should solve your problem. std::sort -- sorts data, std::unique -- removes duplicates from a sorted data.

Member Avatar for glahh
0
109
Member Avatar for ihatestarch

look at this [URL="http://www.asciitable.com/"]Table[/URL] and you will see that each '0' through '9' has a value in numerical standpoint.

Member Avatar for ihatestarch
0
146
Member Avatar for xfreebornx

You might want to change some part of the student to accommodate strings. For example, a name should be a std::string instead of a char. [code] struct student { int ID; char name; char nationality; char gender; }; [/code] To use the keyword delete, for your array, you have to …

Member Avatar for Ancient Dragon
0
321
Member Avatar for Nathan Campos

Pick 1) I) [code]std::cout<<hex;[/code] II)[code]hex(cout);[/code] III)[code]cout.setf(ios_base::hex,ios_base::basefield);[/code] All these shows the output in hex. So no calculation needed.

Member Avatar for Nathan Campos
0
102
Member Avatar for dark_lord

Just an idea, check the window size with glutGet and if its not what you want then resize it.

Member Avatar for mrnutty
0
57
Member Avatar for Yle

If you want 3d the glOrtho is the wrong choice. glOrtho is for 2d. Use gluPerspective(45.0,width/(float)height,1.0,1000.0f); for 3d your reshape functions should look something like this : [code] void reshape (int w, int h) { if( !h) h = 1; glViewport(0,0,w,h); glMatrixMode (GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0, //angle (float)width/height, //ratio 0.001f, //znear …

Member Avatar for mrnutty
0
104
Member Avatar for david777

[quote]"mobile+pond==a"[/quote] What you are doing is comparing with the '==' bool operator. What you are saying with this statement is : Is mobile plus pond equal to a? If so say true else say false. What you want to do is use the assignment operator '='. Setting a = mobile …

Member Avatar for Nick Evan
0
78
Member Avatar for Symbolistic

Look up ray casting for the mouse click and shoot. Basically what you need to do is have a line defined from the mouse click point to the player position vector. Then you have a line from the player to the spot where you clicked with your mouse. Now you …

Member Avatar for William Hemsworth
0
121
Member Avatar for acidnynex

[QUOTE=Dave Sinkula;958455]Consider separating the 1's and 0's with whitespace. Otherwise, you may need to read each character as a char and convert to its equivalent digit.[/QUOTE] the file contains 3 lines of 1,000 integers. That will be a waste of time if you want to separate each int with white …

Member Avatar for acidnynex
0
102
Member Avatar for feroz121

Proper indent! [code] #include<stdio.h> #include<stdlib.h> #include<conio.h> #include<string.h> void main() { FILE *fp,*ft; char another,choice; struct emp; { char name[40]; int age; float bs; }; struct emp e; char empname[40]; long int recsize; fp=fopen("EMP.DAT","rb+"); if(fp==NULL) { fp=fopen("EMP.DAT","wb+"); if(fp==NULL) { puts("cannot open file"); exit(1); } } recsize=sizeof(&e); while(1) { clrscr(); gotoxy(30,10); printf("1.Add …

Member Avatar for Kakooty
0
179
Member Avatar for jeezcak3++

To be a expert programmer rating 10 out of 10, you have to be born to program. But fortunately, there is 9.99. To achieve that rating from range 1 - 10, you have to study and work hard like everything else in this world. One thing I will tell you …

Member Avatar for thelamb
0
143
Member Avatar for digitalhero

Here is a recursion version. Try to make it non-recursion. [code] //row is the number of rows //itr is the number of column (sort of) void prnt(int row = 5,int itr = 1) { if(itr >= row) return; for(int i = 0; i < itr ; i++) cout<<(i+1); cout<<endl; prnt(row,itr+1); …

Member Avatar for mrnutty
0
105
Member Avatar for kernel>panic

Basic encryption, i.e weak but encrypted. 1) Read file content into string 2) Have a key number, say 5. 3) Shift all letter in the string by adding the key number [code] for(int i =0; i < string.size(); i+=) string[i] +=key_number [/code] 4) Now its encrypted. 5) For decryption, just …

Member Avatar for VernonDozier
0
394
Member Avatar for xiikryssiix

If you didn't realize this code : [code] int numX; int numY; int numZ; int sum1 = numX - numZ; int sum2 = numX - numY + numZ; int sum3 = numX + numY; int sum4 = numX + numY + numZ; int sum5 = numX; int sum6 = numX …

Member Avatar for xiikryssiix
0
246
Member Avatar for jiten_raulo

Here are some problems. Easy to harder from my stand point. 1) hello world 2) Advance calculator 3) RPG game 4) your own string class 5) your array class 6) single linked list 7) array class using linked list 8) double linked list 9) Praiser 10) ...out of ideas [U]Printing …

Member Avatar for jiten_raulo
0
142
Member Avatar for aodpreacher

Divide and conquer. Think about those words. When trying to create algorithm, I) you will get better as you gain more experience. II) Think about the algorithm in parts. What do you need to happen first. Then go step by step. Its a simple step but its really powerful. IV) …

Member Avatar for mrnutty
0
103
Member Avatar for gretty

another example : [code] typedef float data_type; data_type mySumRecursive(vector<data_type> vec, data_type * s,int strt = 0) { if(strt == vec.size()) return vec[strt-1]; *s += vec[strt]; mySumRecursive(vec,s,strt+1); } [/code]

Member Avatar for Tom Gunn
0
119
Member Avatar for kernel>panic

[quote]"finding parts of files."[/quote] No, not finding parts of the file but read the whole file, while analyzing it in the process. Assuming the file is the something like this : Info.txt --------------------------------------------- Password = hello_world Active t = false --------------------------------------------- 1) open up a file with fstream 2) read …

Member Avatar for kernel>panic
0
184

The End.