2,712 Posted Topics

Member Avatar for glyd

I don't get it. What eludes people to think that we will use up our time to write a code for someone else without no compensation or without no effort on the other party. I am completely baffled by this type of attitude.

Member Avatar for glyd
0
113
Member Avatar for Frederick2

Are you including other header file that has classes? If so then the class is probably missing a semicolon at the end of its definition. [code] class A { ... } ; <--- need semi-colon? [/code] If you do not have class defined in other header file, then something is …

Member Avatar for Frederick2
0
117
Member Avatar for dennis.wu

Because its inside the class definition. Technically, you can access a class data member , if you are trying to access it inside its definition. Think of class B like a member function accessing its private data, except its a class instead of a function.

Member Avatar for dennis.wu
0
2K
Member Avatar for esesili

[QUOTE=esesili;957172]Thanks for helps. Can you tell me how can I fix it?[/QUOTE] [QUOTE=Dave Sinkula;957161][code]double avg_file(ifstream& source_file) { double number_in_file; double total = 0; int count = 0; [COLOR="Red"]while (source_file >> number_in_file)[/COLOR] { total = number_in_file + total; count ++; } //average of numbers in file return (count); }[/code] [url]http://www.daniweb.com/forums/post155265.html#post155265[/url][/QUOTE] Pay …

Member Avatar for mrnutty
0
131
Member Avatar for themask18

1) [URL="http://www.google.com/search?hl=en&q=sorting++c%2B%2B&aq=f&oq=&aqi=g4"]GOOGLE [/URL] it 2) use std::sort function.

Member Avatar for themask18
0
152
Member Avatar for gopi17

[QUOTE=gopi17;956668]okay, i understand...juz wanna ask...is it possible to create a huge array then minimize the array according to the users input... for example [CODE] game[500][500]; then minimize from there... [/CODE][/QUOTE] I think what you are looking for is [URL="http://reconnetworks.net/forum/index.php/topic,1569.0.html"]vector[/URL] or this [URL="http://www.cplusplus.com/reference/stl/vector/vector/"]vector[/URL] They have the capability of resizing to whatever …

Member Avatar for mrnutty
0
163
Member Avatar for Tusike
Member Avatar for mrnutty
0
95
Member Avatar for chiraag
Member Avatar for acplus

This should be easy. [code] int cntr[256] = {0}: //counter for each character //read in char. //increment cntr for whatever you have read in while(iFile.get( c ) ) { c = ++c % 256; cntr[c] += 1; } [/code] There are still some caution to take, but this should be …

Member Avatar for mrnutty
0
147
Member Avatar for thebluestar

Presumably, using non-temp value is faster. Think of whats going on. using temp : 1) Get the value from the user. 2) Copy that value to the address of temp. 3) Search for the value that resides in temp address 4) Copy that value and put it in the address …

Member Avatar for mrnutty
0
105
Member Avatar for Mnkyman1030

Lets see. Lets just take everything in this code to be related to heap_sort. [code] for(i= 32; i>1; i--) { SortHeap(arr, i - 1); } [/code] I substituted 32 for arr_num_items This is so far 31 iterations. Inside it, Lets see what sortHeap is. [code] for(o=root;o>=0;o--) { //removed for(i=root;i>=0;i--) {//removed …

Member Avatar for mrnutty
0
224
Member Avatar for sara khan

Its stupid : [code] #include<iostream> using std::cout; int main() { int a = 0; cout<<"#include<iostream>\n\nusing\tstd::cout;\n\nint main()\n{\n\tint\ta = 0;\n\n\n\treturn 0;\n}\n\n"; return 0; } [/code]

Member Avatar for rahul8590
0
96
Member Avatar for vibs123

How well do you know c++? for loops, do while, if else, class, ...? Also there is practice problem here.

Member Avatar for tux4life
0
131
Member Avatar for gretty
Member Avatar for mrnutty
0
232
Member Avatar for dennis.wu
Member Avatar for D.JOHN

int getmarks(int marks[][3]); Note : You have to specify the column. Thats why the 3 is there. Although it could be any number.

Member Avatar for D.JOHN
0
157
Member Avatar for atch

"void fun() throw();" That declaration tells compiler that this function , fun(), won't throw any exception. Similarly : void fun() throw(myException& m); Tells compiler and user that this function could throw a exception shown.

Member Avatar for atch
0
121
Member Avatar for bryangarcia

I tried sooo hard to become a physic and see your source code, but no luck. Maybe it would be easier if you posted the code.

Member Avatar for yellowSnow
0
103
Member Avatar for SeriousTyro

Here is an idea, Make a program with one of the language you choose,make a scenario where a random number is generated for about 100,000 times, each random number generated represents a language you should learn in depth with. See which has the most hit, and viola. You got your …

Member Avatar for Salem
0
149
Member Avatar for JameB
Member Avatar for umarmaqsood

Forget about that book. Read a more comprehensive book. I would suggest C++ Primer plus 5th edition. Its a little over 1000 pages long, all about C++ and its beautiful wonders.

Member Avatar for gkaykck
0
135
Member Avatar for gretty
Member Avatar for missty

Damn Ancient Dragon beat me to it. Anyhow here it is : [code] #include <iostream> #include<fstream> using namespace std; int main() { fstream oFile("numbers.txt"); if(!oFile.is_open()) { cout<<"Error opening the file\n"; return 3; } oFile.seekg(0,std::ios::end); unsigned int size = oFile.tellg(); if(!size) cout<<"Empty File\n"; else { char c; while(oFile.get(c)) cout<<c; } } …

Member Avatar for Dave Sinkula
0
3K
Member Avatar for plato_03

I think you need to re think your design. Use for loops instead. Have a function that checks is a number is prime. Is it returns true then print that number. [code] for(int i = 0; i < MAX; i++) if( isPrime(i) ) cout << i <<" is prime : …

Member Avatar for mrnutty
0
139
Member Avatar for dgr231

[code] totalArea = (1/2) * PI * (radius*radius); [/code] what you are calculating is the area of a half of a circle. The area of a circle is pi* r^2

Member Avatar for mrnutty
0
154
Member Avatar for kulli

"The user enters: hhmmss " like this I assume : 074023 which is = 7:40:23 1) check if the 1st and 2nd number is <= 24 2) check if 3rd and 4th number is <= 60 3) check if 5th and 6th number is <= 60 if all return true, …

Member Avatar for mrnutty
0
97
Member Avatar for jeezcak3++
Member Avatar for esesili

Its because you open your file multiple times without reseting its position. Here is your program. I don't know if the output is correct, but it runs: [code] #include<iostream> #include<fstream> #include<cmath> using namespace std; double avg_file(ifstream& source_file) { double number_in_file; double total = 0; int count = 0; source_file >> …

Member Avatar for mrnutty
0
79
Member Avatar for bushimports

[QUOTE=NicAx64;954030]here if you want to make the changes without breaking the code now , make that x y and z mutable. dirty but it will help you not to break the code.[/QUOTE] why would you suggest that? Your just suggesting bad practice.

Member Avatar for mrnutty
0
932
Member Avatar for bond000007
Member Avatar for raul14

From OP pdf file : [code] //Use the following code to check for file error if (input.fail()){ cerr<<"File not found!"<<endl; [COLOR="Red"] system("PAUSE");[/COLOR] return 0 [/code]

Member Avatar for Salem
0
145
Member Avatar for abhishek4563

For question # 1 (a) Is allocated with new or (b)just something like int a[1000000]; option a, use delete []. option b, its destructor is called, and deletes it automatically. But as Ancient dragon pointed out, there could be stack overflow.

Member Avatar for abhishek4563
0
89
Member Avatar for serkOner

Just a wild guess. [U]CGUIEditBox [/U]C - c language? GUI - graphical user interface EditBox - edit box [U]CGUIFont[/U] C - c language ? GUI - graphical user interface Font - font [U]CXMLWriter [/U]C - c language ? XML - Extensible Markup Language Writer - writer

Member Avatar for serkOner
0
126
Member Avatar for low1988

1st - your program should throw an error if both the w and r starts at the same position. I am not understanding your question well, is that you have a problem distinguishing the position of the R? Whats your program trying to simulate?

Member Avatar for mrnutty
0
146
Member Avatar for the great

Here is one of my beginning projects last year : [code] const int row = 1; for(int i = 0; i < row; i++) { for(int j = row-i; j ; j--) cout<<" "; for(int k = i*2; k >= 0; k--) cout<<"*"; cout<<endl; } for(int i = row; i …

Member Avatar for Sky Diploma
0
179
Member Avatar for mcco1

Try ::px = ((rect.right - rect.left) / 2) - 60; I am assuming there is a local variable hiding the global.

Member Avatar for JasonHippy
0
141
Member Avatar for VernonDozier

[URL="http://stackoverflow.com/questions/199333/best-way-to-detect-integer-overflow-in-c-c"]Google[/URL] is your friend. Particularly check the first post. It talks about using MSB to detect overflow.

Member Avatar for Dave Sinkula
1
202
Member Avatar for no1zson

Here is another way you might want to try. Its in c++ though. You could try to convert it into c. [code] float GetFloat() { std::cout<<"Enter a number please : "; float num(0); cin >> num; while(!cin) { cin.clear(); while(cin.get() != '\n') continue; cout<<"\nPlease enter a number : "; cin …

Member Avatar for no1zson
0
174
Member Avatar for osei-akoto

[code]int twodee[5][5];[/code] creates a 5x5 matrix. To draw a graph you might have to use some sort of GUI

Member Avatar for yellowSnow
0
116
Member Avatar for gisairo

Do you know the conversion formula from Fahrenheit to Celsius? If so the rest should be formatting issues. Use a loop from i = 20 to i <= 300, and use the conversion formula and display the corresponding Celsius to a Fahrenheit, or vice versa.

Member Avatar for mrnutty
0
78
Member Avatar for mbulaheni

See if this could help you. It is my string class assignment operator function. [code] Letters& Letters::operator =(Letters& Str1) //assignment operator { if(this == &Str1) //check for self assignment return *this; delete [] str; Len = Str1.Len; str = new char[Len+1]; strcpy(str,Str1.str); str[Len] = NULL; return *this; } [/code] I …

Member Avatar for mbulaheni
-1
118
Member Avatar for gretty

I think you can just do the following : get the user input. Find '?' character. Replace '?' character with some other letter. Check for valid word. save it to result list.

Member Avatar for VernonDozier
0
441
Member Avatar for tomtetlaw

I don't know if this was mentioned, but when you have a function pointer like for example, float (*pF)(float) , you can only pass it a function that has the same prototype. For example : [code] void drawGraph( float (*graphFunc)(float x) , float leftBound, float rightBound, float epsilon ) { …

Member Avatar for mrnutty
0
110
Member Avatar for the great

If you print them side by side then it would make a blank diamond shape in the middle. So instead of creating different shape 1 by one, try to think about the whole shape as one. In fact, draw it on a piece of paper, and try to think of …

Member Avatar for Sky Diploma
0
143
Member Avatar for NickyU

here is one that I use sometimes. Note that this does not work for every bitmap images. [code] int LoadBitmap( wchar_t* filename) { GLubyte* pixels; HBITMAP hbmp; BITMAP bmp; GLuint size; GLenum format; GLuint totalBytes; texID++; hbmp=(HBITMAP)LoadImage(GetModuleHandle(NULL), filename, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE ); if(hbmp==NULL) { MessageBox(NULL,L"ERROR : CANNOT …

Member Avatar for mrnutty
0
729
Member Avatar for jake43

[QUOTE=Tom Gunn;951013] [code=cplusplus] // code intentionally advanced to deter cheaters #include <algorithm> #include <functional> #include <iostream> #include <iterator> #include <numeric> #include <vector> #include <cmath> template <typename T> struct SquareOfDiff: public std::binary_function<T, double, T> { T operator()(T x, double mean) const { x -= (T)mean; return x *= x; } }; …

Member Avatar for Tom Gunn
0
620
Member Avatar for jake43
Member Avatar for mrnutty
0
208
Member Avatar for Belthemet

Go for class structure. It will definitely be a lot easier and less work, as well as more elegant. Here are some ideas : [code] class Hero{}; class BigHeadMonster { }; class Items { }; class Story { }; Class Map { }; [/code] Pick a class, start implementing it, …

Member Avatar for Belthemet
0
153
Member Avatar for beau_nerdathen

This is cute. First of, look at the patterns. Tell me what you can figure. Its interesting how the patterns unfolds. Just look at the result : [code] a b c b c d e d c d e f g f e d e f g h i h …

Member Avatar for mrnutty
0
94
Member Avatar for kspicer

Its much easier than you are making it. [code] cin >> limitNum; for(int i = 0; i < limitNum; i++) cout<<i<<" "; [/code]

Member Avatar for kspicer
0
107

The End.