2,712 Posted Topics
Re: sure whats the question, exactly? | |
Re: 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] | |
Re: >>// output: 4 (?!) Shouldn't this be an error? It is. And its a bad one, which went undetected in a sense. | |
Re: >>[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 … | |
Re: Using the stringstream will make it easier. Or you can use substr as well, but will be more work. | |
Re: its used to indicate if the number is prime or not. | |
Re: I recommend using the [URL="http://openil.sourceforge.net/"]devIL[/URL] library. Let them handle loading images. | |
| |
Re: 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. | |
Re: Your base case is wrong. When should your function return or Stop ? | |
Re: 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. | |
Re: 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. | |
Re: [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 … | |
Re: 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 … | |
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 … | |
Re: 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? | |
Re: 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 … | |
Re: 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 … | |
Re: [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 : … | |
Re: [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 … | |
Re: 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 … | |
Re: 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 ? | |
Re: 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]. | |
Re: 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 … | |
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 … | |
Re: It could be your text file. Towards the end, you might have empty lines in your file. Check it. | |
Re: [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? | |
Re: 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 … | |
Re: 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] … | |
Re: 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 … | |
![]() | Re: 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. |
Re: Try this : [code] #include<iostream> using namespace std; int main(){ cout << "Hello World\n"; return 0; } [/code] | |
![]() | Re: 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. ![]() |
Re: 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 ? | |
Re: Just load it into paint, and use the resize feature. | |
Re: 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] | |
Re: [code] int n = 15; cout << hex; cout << n << endl; [/code] | |
Re: Before I say something, what do you think this statement is doing : [code] struct word_list * new = NULL; [/code] | |
Re: >>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 … | |
Re: 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] … | |
Re: "&" 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. | |
Re: [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. … | |
Re: 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 … | |
Re: 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. | |
Re: 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(); … | |
Re: [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]. | |
Re: 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. |
The End.