2,712 Posted Topics

Member Avatar for rehamz
Member Avatar for johndoe444

Yes, but use classes. Prefer classes to structs. [code] template<typename Type> class CStack { public: const static int MAX = 100; private: Type _array[MAX]; size_t currentMaxIndex; }; [/code]

Member Avatar for mrnutty
0
135
Member Avatar for pac-man

>>// output: 4 (?!) Shouldn't this be an error? It is. And its a bad one, which went undetected in a sense.

Member Avatar for pac-man
0
125
Member Avatar for NicAx64

>>[b] what is you're ideas , please analyze that flaw of wolfram alpha[/b] >>[b] The answer is so big the not even 64-bit can store the number[/b] No sh*t. Its approximately 392,717,716,282 digits long. There is no flaw in wolfram. Its made my brilliant mathematicians and great programmers. No offence …

Member Avatar for mrnutty
0
140
Member Avatar for jegadees

Using the stringstream will make it easier. Or you can use substr as well, but will be more work.

Member Avatar for mrnutty
0
140
Member Avatar for ireimaima
Member Avatar for Joehype

I recommend using the [URL="http://openil.sourceforge.net/"]devIL[/URL] library. Let them handle loading images.

Member Avatar for mrnutty
0
176
Member Avatar for ireimaima
Member Avatar for GrimJack

That sounds nasty. I tell you, greed makes people do bad things. I'm glad I try to eat healthy as possible and usually stay away from commercialized beef burgers.

Member Avatar for GrimJack
2
124
Member Avatar for fadia
Member Avatar for serra01
Member Avatar for Silvershaft

I think there might be more support for SDL than SFML in the internet. Maybe pick one based the support it has online. So you get more documents and tutorials for your benefit.

Member Avatar for Silvershaft
0
582
Member Avatar for Enhancelogic

Remember a string is just bunch of characters. Thus [CODE] std::string stars(10,'*); [/CODE] says the stars consists of 10 characters, where those 10 characters are all '*'; string.size() returns the number of characters the string contains.

Member Avatar for mrnutty
1
301
Member Avatar for samsons17

[QUOTE=samsons17;1094962]i just dont know whats the function to detect the upper and the lower case letter in this kind of program...i've tried finding it on the internet but couldnt find it..so thats why i'm asking here..without it for sure i cannot even start to code this program....[/QUOTE] [URL="http://www.cplusplus.com/reference/clibrary/cctype/"]This[/URL]will answer all …

Member Avatar for mrnutty
-2
175
Member Avatar for DarkC0de

Control-D represents the end of file. So either read until the end of File, or Make some special characters to represent the end of fie. As suggested you can do something like this : [code] const std::string END = "EOF" while file.isNotEmpty { std::string content ; getline( file, content, END …

Member Avatar for DarkC0de
0
774
Member Avatar for mrnutty

In this challenge there are 3 question, beginner, intermediate, and others. Beginner: [b] [ICODE]1) Find the sum of all Natural numbers that are a multiple of 3 or 11, from 1 to 100,000. [/ICODE][/b] Intermediate: [b] [ICODE]The prime factors of 13195 are 5, 7, 13 and 29. What is the …

Member Avatar for mrnutty
0
146
Member Avatar for Skeen

I think a good start would be to create a linked list. Since you don't know templates yet, you don't have to create a template linked list. Do you know what a linked list is?

Member Avatar for manishanibhwani
0
93
Member Avatar for mythili_sharon

Which one is most likely , ++i or i++ : [code] //++i OR i++ ? { int temp = i; i = i+1; return temp; } [/code] [code] //++i OR i++ ? { i = i + 1; return i; } [/code] Maybe the name will help you : ++i …

Member Avatar for manishanibhwani
0
140
Member Avatar for johndoe444

Maybe this will help : [code] //regular pointer int *ptr = 0; //pointer-to-const-data type //pointer can change what its pointing to const int * ptr = 0; //const-pointer //pointer can't change what its pointing to //pointer can only point to non-const object int * const ptr = 0; //Now combine …

Member Avatar for Dave Sinkula
0
402
Member Avatar for Pamilerin
Member Avatar for Nick Evan
0
77
Member Avatar for gedas

[code] lastElem =remove_if(v1.begin(), v1.end(), islowerCase);//line1 [/code] Line 1 : remove_if(...), if the containers contains a lower case character the function removes it. It does this, and returns the a pointer that points to the new end since some elements has been deleted. [code] ostream_iterator<char> screen(cout, "");//line2 [/code] Line 2 : …

Member Avatar for gedas
0
138
Member Avatar for Nhevik

[QUOTE=Nhevik;1093922]how to create a program using C++ pls tech me :P ;)[/QUOTE] First download and IDE, I prefer, [URL="http://www.microsoft.com/express/download/#webInstall"]Microsoft visual C++ express edition 2008.[/URL] Its the bottom left, with the yellow colored box. Second learn how to create a project, google it up. Third, youtube , "hello world program in …

Member Avatar for mrnutty
0
171
Member Avatar for Iam3R

Doesn't anyone see a problem with this : [code] int * first() { int f_lcl = 0xAAAA ; printf(" In First : value of f_lcl ( %x ) \n", f_lcl); printf(" In First : addr of f_lcl is ( %p ) \n", (void*)&f_lcl); return &f_lcl ; } [/code] He is …

Member Avatar for Tajon Wong
0
361
Member Avatar for anushri

1) Do you know how to write to file ? 2) Do you know the difference between , int i = 1; and char j = '1' ? 3) Do you know how to make a for loop ?

Member Avatar for mrnutty
0
64
Member Avatar for damaged

This is wrong : [code] while (x!=0,y!=0,x>=y)[/code] Use either the logical AND operator( "&&" ) or the logical OR operator( "||") Same here : [code] if (a!=b,a<=b)[/code].

Member Avatar for damaged
0
136
Member Avatar for new programer

Before you write this program you need to think about the problem. You said you want to " have the percentage of smilarity". You have the right idea about using strcmp, but its not what you should use. For this you should use std::string. So lets talk about what you …

Member Avatar for Salem
0
114
Member Avatar for mrnutty

More bullshit, what does it really matter? A new [URL="http://news.nationalgeographic.com/news/2009/10/091001-oldest-human-skeleton-ardi-missing-link-chimps-ardipithecus-ramidus.html"]Missing Link[/URL] has been found. If what they say is true then all that I have been taught by be anthropology teacher and alike has been bUllShit. Its all crap. What does it really matter if we "come" from moneys or …

Member Avatar for VernonDozier
-1
269
Member Avatar for biesczadka

It could be your text file. Towards the end, you might have empty lines in your file. Check it.

Member Avatar for mrnutty
0
86
Member Avatar for لولوة

[QUOTE=iamthwee;1090066]Just make everything public then you don't need to! [url]http://www.darronschall.com/weblog/2005/03/no-brain-getter-and-setters.cfm[/url][/QUOTE] What happens when those brainless getters and setter, need to serve some purpose later one the code, or when the maintainer needs to change some code, or if the programmer makes some mistakes?

Member Avatar for Dave Sinkula
0
213
Member Avatar for kevintse

You can do something like this : [code] #include <iostream> #include <string> #include <stdexcept> using namespace std; class Trouble : public std::exception { private: string errMsg; public: Trouble(const wstring msg) //convert from wstring to string : exception( string(msg.begin(), msg.end() ).c_str() ) { errMsg = string( msg.begin(), msg.end() ); //testing throw …

Member Avatar for kevintse
0
3K
Member Avatar for aladar04

A conditional expression with more than 2 statement is just the same as two separate conditional expression. For example : [code] while( gameIsRunning ) { if( keyPressed ) if( keyPressedIsX){ .. } } [/code] Is the same as : [code] while(gameIsRunning) { if(keyPressed && keyPressedIsX) { ... } } [/code] …

Member Avatar for aladar04
0
532
Member Avatar for manosha

Also change this : [code] double getSidelength(int);//gets the values [/code] to this : [code] int getSideLength(); //gets the values [/code] There is no need for the int parameter, as well as the double return value, since you are returning your int member variable. This is completely wrong : [code] for …

Member Avatar for jBat
-4
132
Member Avatar for snarb
Member Avatar for _Michael_

Just do something like this : [code] string num = ""; cin >> num; while( !isNumber( num ) ){ cout << "Only numbers allowed, Try again : " ; cin >> num; } [/code] isNumber is your own function that uses the isdigits() function from cctype.

Member Avatar for WaltP
0
121
Member Avatar for MKO

Try this : [code] #include<iostream> using namespace std; int main(){ cout << "Hello World\n"; return 0; } [/code]

Member Avatar for Salem
0
128
Member Avatar for begueradj

If you wan't to learn about linked list, try implementing it. Give it a shot and tells us how it goes, that is if your up for it.

Member Avatar for begueradj
0
101
Member Avatar for pink16

I assume you don't know how to write a code for this. So before any code is written. Think about how one would compute x^y, where x is the base and y is the exponent. Why is 2^10 = 1024 ? Why is 2^3 = 8 ?

Member Avatar for jonsca
-1
91
Member Avatar for yanseung
Member Avatar for daudiam

If anyone is worried about which makes his code faster : [CODE]A) ++a; B) a++; C) a = a + 1; d) a += 1; [/CODE] [B]Then I am more worried about his code.[/B]

Member Avatar for nezachem
0
637
Member Avatar for Excizted
Member Avatar for Excizted
0
149
Member Avatar for doraemon79

Before I say something, what do you think this statement is doing : [code] struct word_list * new = NULL; [/code]

Member Avatar for doraemon79
0
2K
Member Avatar for Excizted

>>I'm wondering if I'm duplicating this class by doing the following. Maybe. If inside the class definition contains some data members thats a pointer-to-someDataType. Then you need a deep copy. Otherwise, the pointer variable from the variable "point' with point to the same address as the pointer variable from the …

Member Avatar for mrnutty
0
96
Member Avatar for kizzer

Here is a way you can solve it : [ICODE](152)_8 = (1 * 8^2 ) + (5 * 8^1) + (2*8^0) = 64 + 40 + 2 = (106)_10[/ICODE] Similarly : [ICODE](211)_x = (2 * x^2) + (1 * x^1) + (1 * x^0) = 2x^2 + x + 1[/ICODE] …

Member Avatar for Seten
-1
247
Member Avatar for samsons17

"&" is the bitwise operator when used in proper context. "&" is reference operator when used in proper context. "*" is a multiplication operator when used in proper context. "*" is a de-referencing operator when used in proper context. "&*" is a reference to a pointer type.

Member Avatar for mrnutty
0
81
Member Avatar for SoulReaper1680

[CODE]"OpenGL is the industry's most widely used, supported and best documented 2D/3D graphics API making it inexpensive & easy to obtain information on implementing OpenGL in hardware and software"[/CODE] Its a graphics library that provides an interface for the user to draw 2d or 3d. Glut and SDL are similar. …

Member Avatar for SoulReaper1680
0
121
Member Avatar for jhayar

Find the zero of the function [CODE] x^2 - 5 = 0[/CODE], that is, find what value for x, will cause this function [CODE]x^2 - 5[/CODE] to equal zero. A good approach will use calculus and for loops. Note by finding the zero of the function x^2 - 5, you …

Member Avatar for mrnutty
0
62
Member Avatar for cwarn23

First the numbers you can accept is limited to the bytes of memory the computer has. For an algorithm for division of large numbers, google newton raphson method.

Member Avatar for cwarn23
0
101
Member Avatar for AddyMan

This code : [code] if (positionHuman == 'A') { grid [0][0] = 'X'; showgrid(); } else if (positionHuman == 'B') { grid [0][1] = 'X'; showgrid(); } else if (positionHuman == 'C') { grid [0][2] = 'X'; showgrid(); } else if (positionHuman == 'D') { grid [1][0] = 'X'; showgrid(); …

Member Avatar for mrnutty
0
66
Member Avatar for Stefano Mtangoo

[QUOTE=evstevemd;1088730]. Do I need to know SDL before I can use SDL_MIXER [/quote] Depends. But you probably need to know the basics of SDL, i.e know how to use some of its interface. [quote] good tutorial for begginner? [/QUOTE] You tell me [URL="http://www.google.com/search?hl=en&source=hp&fkt=1916&fsdt=6826&q=sdl_mixer+tutorial&aq=0&aql=&aqi=g1&oq=sdl_mixer+t"] google [/URL].

Member Avatar for mrnutty
0
87
Member Avatar for moomeen

well you know that the file contains an integer and a char and it repeats. So read in a integer first then read in the char. Use the integer and forget about the char.

Member Avatar for mrnutty
0
82

The End.