2,712 Posted Topics

Member Avatar for PDB1982

Hold shift front_slash. The frontslash is usually on top of the enter key.

Member Avatar for PDB1982
0
52
Member Avatar for Kuroshi

Ouch, your logic is bad. You are killing your program slowly. Luckily it fights back with the runtime exceptions. Can you comment line by line so I see what your thinking process is. That way you will learn better when you see whats wrong.

Member Avatar for Kuroshi
0
174
Member Avatar for moods125

You have this : "<< printMonth(x);" In most of your function. Take out the "<<" and let it just be printMonth().

Member Avatar for moods125
0
202
Member Avatar for confusedndazed

no. the k is passed in from main. So k can be any number. For example, inside you main : [code] int main() { binomial(5, 10); // here k = 10; binomial(3, 276); // here k is 276 } [/code]

Member Avatar for confusedndazed
0
153
Member Avatar for confusedndazed

>>denominator = 1*2*...*k I hope you know thats not valid. 1 * 2 * 3 ... k is called the factorial of K So if K was 5, the the denominator will be 1 * 2 * 3 * 4 * 5. So make a function : unsigned long factorial(unsigned …

Member Avatar for lotrsimp12345
0
118
Member Avatar for micke

[QUOTE=donaldw;1066249]Modulo 10? eg: 54%10 = 4[/QUOTE] TO expand x % 100 will give you the last 2 digits, and x % 1000 will give you last 3 digits, and in general : x % 10^n will give you the last n digits. IN the special case where n = 0, …

Member Avatar for donaldw
0
270
Member Avatar for lonprog

[QUOTE=Narue;1066145][B]>Does anyone have code out there on how to do this?[/B] Assuming this is homework, you don't really learn anything by stealing another programmer's code and palming it off as your own.[/QUOTE] Sure you do. You learn the intricate art of stealing programs and plagiarizing it, while feeling completely not …

Member Avatar for mrnutty
0
120
Member Avatar for arsenal23114

Can you use polar coordinate, or this equation of the circle ? [code] for theta = 0 to theta < 360 degrees; ++theta{ x = cos(theta) * radius y = sin(theta) * radius //center* is where the circle should be centered at drawAndFillPoint(x - centerX , y - centerY) } …

Member Avatar for mrnutty
1
92
Member Avatar for adraganov

You need to do a little more : [code] int LoadBitmap(const char* filename) { GLubyte* pixels; HBITMAP hbmp; BITMAP bmp; GLuint size; GLenum format; GLuint totalBytes; texID++; hbmp=(HBITMAP)LoadImage(GetModuleHandle(NULL), (LPWSTR)filename.c_str(), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE ); if(hbmp==NULL) { MessageBox(NULL,L"ERROR : CANNOT LOAD FILE!",L"IMAGE LOADING",MB_OK); return -1; } GetObject(hbmp,sizeof(bmp), &bmp); size …

Member Avatar for adraganov
0
267
Member Avatar for godsgift2dagame

Or just return an array of strings, whichever one, both do the same job and depending on the context, one might be better to use than the other.

Member Avatar for jonsca
0
165
Member Avatar for lotrsimp12345

When printing a binary tree you can either print it in pre, mid, or post order. I am not going to explain all of these. You should google them. The usual way one would display a binary tree is by either one of the printing methods from above, pre ,post …

Member Avatar for lotrsimp12345
0
105
Member Avatar for xonxon

I suggest make a binary tree class and make the printing function. Add a few numbers. And print them out pre,post, and mid. Examine the output. Try to construct a binary tree from the output. You will then realize the pattern.

Member Avatar for mrnutty
0
142
Member Avatar for rrvs331

[QUOTE=rrvs331;1065639]Can you give me an example, as to how to use this, because I want to set the range of numbers.[/QUOTE] [code] int main() { srand( time( 0 ) ); cout << rand() % 2 << endl; } [/code]

Member Avatar for rrvs331
0
233
Member Avatar for nychick

You can do that or you can do what dkalita suggested. To expand on his suggestion : Say the input is "1001". To check if it is a palindrome you need to compare the first value + n, to the last value - n. Lets start : [code] // Input …

Member Avatar for mrnutty
0
96
Member Avatar for PDB1982

Ouch. First off your code is not very readable. In fact there are statements in your code that you probably think is doing something else than it does. I think we need to take this step by step, for your sake and for my eyes. So what is your main …

Member Avatar for jonsca
0
118
Member Avatar for gogo000
Re: c++

use [URL="http://www.cplusplus.com/reference/iostream/stringstream/stringstream/"] stringstream[/URL]

Member Avatar for mrnutty
0
95
Member Avatar for mariusmssj

Use strings and sstream. Get the input as strings. For example : [code] string input = ""; cout << "<enter text > :\t"; getline(cin,input); [/code] Then use sstream to extract words by words, using the space between them as delimiters. If you don't know about the sstream, read up on …

Member Avatar for mrnutty
0
172
Member Avatar for fabfour

Start out with the rock paper scissor games. I'll try to give you a psuedo code body. (Not saying its right though) [code] #include<iostream> using namespace std; //function prototype char getRandom(); //return random rock , paper , or scissors int main() { //create variables char playerPick= 0; char computerPick = …

Member Avatar for mrnutty
1
139
Member Avatar for Towely

See if this works. Also since you are using string and cctype header, you should capitalize on their functions. I changed your functions a little bit : [code] #include <iostream> #include <string> #include <cctype> using namespace std; string pigLatin(string); bool isVowel(string); bool isCapital (char); bool isConsonant (string); string flipword (string); …

Member Avatar for Towely
0
188
Member Avatar for merse

[QUOTE=merse;1064936]String is an object, but it can be initialize without (), like [CODE]string str;[/CODE] However if I define a user defined object, I must initialize it like: [CODE]myclass myobj(); [/CODE] How is it possibel to not use: () ?[/QUOTE] The compiler will most likely mistake myobj as a function! As …

Member Avatar for mrnutty
0
101
Member Avatar for Mclovin1234

[QUOTE=Narue;1064986][B]>I have no clue on how to do this please help thank you [/B] You'd better learn quickly how to deal with this situation without running to someone else for hand holding. The majority of the time, a programmer has no clue how to do something. That's why it's such …

Member Avatar for mrnutty
0
98
Member Avatar for hamidvosugh
Member Avatar for Bemani_lover

First make two variables, sentence1 and sentence2, unless you are using a period '.' as the end of one sentence. Use string if possible. All you need to do is capitalize sentence[0], the first letter. if its lower case then use the function from cctype, toupper(char). It returns the uppercased …

Member Avatar for Bemani_lover
0
182
Member Avatar for DawnOfIkaros

Easiest way to do it is with [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/rand/"]the rand function[/URL]

Member Avatar for DawnOfIkaros
0
66
Member Avatar for facadie

Not sure but here is a suggestiong. Look at the pixel where its way off the average , so if a camera lens is white , then its average should be close to white. If there is a dirt on the lens, then its pixel will be way of the …

Member Avatar for Nick Evan
0
96
Member Avatar for mymyzzz
Re: SORT

For bubble sort all you have to do is blindly swap : [code] int A[5] = {5,3,1,7}; //bubble sort for(int i = 0; i < 5; i++){ for(int j = i+1; j < 5; j++) if(A[i] > A[j] ) std::swap(A[i],A[j]); } [/code]

Member Avatar for Nick Evan
0
106
Member Avatar for govindak

Sure what part. There is a lot. You need to be more specific. Take it part by part. Do you need help with input and output, vectors, algorithms, what?

Member Avatar for govindak
0
79
Member Avatar for T-Dogg3030

An even easier way :[URL="http://www.cplusplus.com/reference/iostream/istream/tellg/"]Link[/URL]

Member Avatar for T-Dogg3030
0
96
Member Avatar for sexyzebra19

If your function parameters looks this this : [CODE]foo( Type a, Type b, Type c, Type d, Type e, Type f ...[/CODE] The that suggest that you either need to break up your functions into more small and compact and readable function or use OOP programming.

Member Avatar for mrnutty
0
96
Member Avatar for BrownBearForU

since you are using vectors, and the vectors already contains data, then all you have to do is jumble up the data into different place. Therefore there is a function called std::random_shuffle that does just that. Here is the [URL="http://www.cplusplus.com/reference/algorithm/random_shuffle/"] link[/URL]. Unsurprisingly, they use vectors as an example.

Member Avatar for BrownBearForU
0
167
Member Avatar for scott6480

its not substr[i], its substr(i); Plus you are making this way to complicated. But before I suggest something, Are these assumptions correct : 1) You are comparing the student answer keys with the correct ones. 2) The student has answered all the question. 3) You need to count how many …

Member Avatar for mrnutty
0
151
Member Avatar for Web_Sailor
Member Avatar for mrnutty

[URL="http://thedailywtf.com/Articles/Vector_Oriented_Programming.aspx"]This is too hilarious.[/URL]

1
42
Member Avatar for noey699
Member Avatar for norbert90
Member Avatar for Clinton Portis
-5
93
Member Avatar for subhankar02dey

Use the mode (%) operator inside a for loop like so : [code] final int MAX = 100; for(int i = 1; i < MAX; ++i){ if(i % 2 == 0 ) /* if i is a multiple of 2 */ { //do stuff } else if(i % 3 == …

Member Avatar for tjsail
0
140
Member Avatar for foxmulder

Do you have a sample run? Is it something like this you think : [code] Enter n : 10 From [0,10] there are 11 different numbers. [/code]

Member Avatar for samsons17
0
142
Member Avatar for abd2

You put (Nov 28th 2009): [QUOTE=mGabriel;1061354]You put: <code snipped> Cya.[/QUOTE] He put ( Jul 16th, 2004 ): [quote] hi, this is the code for switch: include <stdio.h> <snipped> [/quote] See the problem?

Member Avatar for mrnutty
1
156
Member Avatar for tomtetlaw

If you have a stack overflow then try to allocate on heap. Use smart pointers if you can.

Member Avatar for tomtetlaw
0
240
Member Avatar for NitaB

In all of your program you have never initialized the Size variable! I didn't know that the array has to be sorted from the number of occurrence, sorry. Edit : would you mind using something like map. It would be easy. Or actually using struct would be easy too. And …

Member Avatar for NitaB
0
135
Member Avatar for gen84
Member Avatar for sexyzebra19

>>x^2 + 0.17714x -2.5147583 with k = 1.4997 What does the k represent ? Also for vectors you can just assign another vector by using the '=' assignment operator. If you want the reverse it, then use the std::reverse to reverse a vector then use the assignment operator, better practice.

Member Avatar for mrnutty
0
112
Member Avatar for Eternity[LK]

You don't have to manipulate the array after being sorted. You can use a for loop to start from 1 to the array size to show the array. This would disclude the last element. Of course you need to see a 0 at the beginning, so before the for loop …

Member Avatar for Eternity[LK]
0
97
Member Avatar for r00ty

What you are doing is reading the first file and then reading the seconds file. Read both the files at the same time.

Member Avatar for r00ty
0
161
Member Avatar for Trekforever

Yes, use string. If not, then create a variable for the left side before t, then a variable for the right side after t. Then concate left and right to make a new c-string.

Member Avatar for JasonHippy
0
1K
Member Avatar for Snippset
Member Avatar for grafas7

So you want to consider only the even row and column. The see if that even row or column is a even number, if so set it to 0 else do nothing?

Member Avatar for grafas7
0
137
Member Avatar for mrnutty

I use netbeans but was wondering if anyone knew how to add a Java compiler to visual studio 2008?

Member Avatar for mrnutty
0
150
Member Avatar for AndrewYY
Member Avatar for ENCHTERP

To use the copy command for a 2d vector, you would have to copy each row into the array, not efficient to make so many calls if a few for loops would do.

Member Avatar for mrnutty
0
129

The End.