Posts
 
Reputation
Joined
Last Seen
Ranked #67
Strength to Increase Rep
+15
Strength to Decrease Rep
-3
84% Quality Score
Upvotes Received
518
Posts with Upvotes
443
Upvoting Members
244
Downvotes Received
104
Posts with Downvotes
86
Downvoting Members
52
171 Commented Posts
~1.38M People Reached
PC Specs
Computers
Favorite Tags
c++ x 3K
java x 102
c x 84
oop x 22

2,712 Posted Topics

Member Avatar for vegaseat
Member Avatar for 3cats

Since you are already using std::string, I figure to help you concise this function : [code] //method to check if the current character is a vowel bool IsVowel(char chr) { switch (chr) { case 'A': case 'E': case 'I': case 'O': case 'U': case 'Y': case 'a': case 'e': case …

Member Avatar for Mahim_1
0
2K
Member Avatar for Dmiller071
Member Avatar for oussama_5
0
235
Member Avatar for din_hilmi

1) Why ? 2) need compile time variable meaning there will be a fixed amount of inputs to get 3) Need to implement your own sorting method and use it inside main, so technically it won't be a function. If not then you will need a lot of if/else or …

Member Avatar for Aditya_47
0
44K
Member Avatar for JoBe

You can prove this by giving just 1 simple example. No need for general proof, because if it can't work for even 1 case, then its incorrect.

Member Avatar for Alfonso_4
0
876
Member Avatar for pags920

First off, this code : [code] #define false 0 #define true 1 char s[100]; char sr[100]; [/code] Is bad already. You do not need to use define. C++ already has, "true" and "false" defined. Next : [code] int main(){ InputString(); system("PAUSE"); return 0; } [/code] No need to use a …

Member Avatar for gravity_1
0
2K
Member Avatar for Jiwe
Member Avatar for networkZombie

The key idea is to use the [URL="http://en.wikipedia.org/wiki/Modulo_operation"]modulo operation[/URL]. For example [icode]if(num % 2 == 0){...}[/icode] means that [i]num[/i] is evenly divided by 2, thus checks if num is even. Use that idea. Your algorithm is more complicated than it needs to be.

Member Avatar for memson
0
523
Member Avatar for restrictment

>> And it's kinda the whole point of C++ No its not. C++ != OOP. C++ has OOP, but does not mean C++ is OOP.

Member Avatar for emeraldamerican
0
6K
Member Avatar for super-duper

Just a quick explanation on [B]Abstract [/B]Data Type(ADT) [b]WHO[/b]: Abstract Data Type [b]WHAT[/b]: Abstract Data Type are data-type that combines the common functionalities from different related objects into one package, so that those different but related object's interface can inherit from the ADT thus making it more flexible and and …

Member Avatar for rucha_1
0
2K
Member Avatar for stefy14

>>[B]I want to my program to prompt user to input a number with three or more integers [/B] You know how to get the user input into a variable right ? [code] int var1 = 0 , var2 = 0, var3 = 0; cin >> var1 >> var2 >> var3; …

Member Avatar for amisha_1
0
58K
Member Avatar for Member 785072

[QUOTE=Nick Evan;1268790][B]>>If there are three logic bugs in total and one's down, two are left. [/B] Holy shit. That's some amazing math! Although you obviously think otherwise: I'm not stupid. I was asking [I]where[/I] the two remaining errors are.[/QUOTE] I think he got this code from the book. And the …

Member Avatar for Matic_1
0
979
Member Avatar for qqwushi12345

Of course we're not gonna do this, unless you pay me $20.00 dollars for this problem. But to start you off, this is the quadratic equation : [code] x = -b/(2a) +- sqrt(b^2 - 4ac) / (2a). [/code] Since they gave you a,b, and c. You just have to plug …

Member Avatar for mohanned_2
0
4K
Member Avatar for Sudo Bash

Bad naming, time is already defined in ctime [code] #include <iostream> #include <ctime> using namespace std; int main() { clock_t start = clock(); cout << "press enter..."; cin.ignore(); clock_t finish = clock(); double doneTime = float(finish-start)/CLOCKS_PER_SEC; cout << "you took " << doneTime << " seconds\n"; return 0; } [/code]

Member Avatar for Yangang
0
4K
Member Avatar for restrictment

Piece of cake, kinda crude approximation tho. [code] #include <iostream> #include <cmath> #include <string> #include <vector> using namespace std; const unsigned CANVAS_WIDTH = 20; const unsigned CANVAS_HEIGHT = 20; const unsigned char BACKGROUND_FILL = '#'; const char POINT = '*'; const float PI = 3.14159265f; const float DEGREE_TO_RADIAN_FACTOR = 0.0174532925f; …

Member Avatar for CharlieCap
2
2K
Member Avatar for kylcrow

A problem I see by the suggested solutions so far that is, it is inefficient if one calls the function numerous times. So in the long run it will probably be better to read it into a vector and use that vector to extract lines. That way you get rid …

Member Avatar for zia shaikh
0
5K
Member Avatar for thehivetyrant

That's why people shouldn't jump too early into graphics without good knowledge of the basics. Ball is a function. It is not a class nor a struct. Thus you cannot use the dot operator on ball. A easy way to get the ball to move is by doing something like …

Member Avatar for Hasan_4
0
6K
Member Avatar for vegaseat

Royal blue, bought my first car last summer. 2007 tiburon GT. Sexy little self. Got it for a bargin too. 21K miles for 8G.

Member Avatar for rockingjohncart
0
334
Member Avatar for violet101

For part a) make a copy. For that copy, uppercase the first letter. Print it backwards. For part d) make a copy. Swap certain positions. Print out the copy backwards.

Member Avatar for larz_1
0
607
Member Avatar for William Hemsworth
Member Avatar for thetukiet
1
7K
Member Avatar for rythreion

If you know how to convert from base 10 to base 2, then you know how to convert from any base to any other base. So the question remains, do you know how to convert from base 10 to base 2?

Member Avatar for NathanOliver
0
4K
Member Avatar for vjcagay
Member Avatar for ilovec++

a) In a 32-bit system, a reference variable needs at least 4 bytes of memory and in a 64-but system, it needs at least 5 bytes. That's because a reference points to the memory of the variable its pointing to. Thus it needs only enough memory to store a memory …

Member Avatar for yoavip
0
566
Member Avatar for myk45

Data Abstraction means something like this : //Shape provides no implementation of the draw functions //It abstracts the draw function from other shapes meaning that it //defines functions that all type of shapes should necessarily have. class Shape{ public: virtual void draw()const=0; }; class Ellipse : Shape{ public: void draw()const{ …

Member Avatar for naaz.kaushik.3
0
878
Member Avatar for olelink

You can use your browser and setup an autofill option, so that when needing to fill out a form, the browser can try to autofill it. Other than that, you need to justify why you would want to do this.

Member Avatar for nittu sarathe
-2
575
Member Avatar for SpS

[code] int i = 0; while(!cin >> i) { cout<<"\nNot valid Try again : "<<endl; cin.clear(); while(cin.get() != '\n') ; } cout<<"Valid\n"; [/code]

Member Avatar for VikyTushar
0
857
Member Avatar for IT seeker
Member Avatar for themaestro

Its not possible to do this with just C++. But you can approximate it like so : [code] #include <iostream> #include <string> #include <ctime> using namespace std; int ask(const string& question){ cout << question; int ans = 0; cin >> ans; return ans; } int main(){ const int MAX_TIME_LIMIT = …

Member Avatar for viorel994
0
3K
Member Avatar for debasisdas

"Shake sphere game us to be or not to be ", computer gave us 0xFF" -------------------- 2B|~2B = 0xFF --------------------

Member Avatar for James_28
8
17K
Member Avatar for mrnutty

Me? Oh nothing much, just bored at work. Working on a new web-app project on my free time. Planned to be in the appstore. Going to hit #1, just watch. How about you?

Member Avatar for GrimJack
0
284
Member Avatar for Labdabeta

Skip defines and macros. Use enums when you need type saftey and when it makes more sense.

Member Avatar for Ancient Dragon
0
1K
Member Avatar for MisterGlow

C++ doesn't have an interface to allow you to create any GUI code, but you can use external libraries to draw the GUI stuff and control it with C++. For example here is a gui application in C++ using the QT library: #include <qapplication.h> #include <qpushbutton.h> int main( int argc, …

Member Avatar for mrnutty
0
181
Member Avatar for android_gl

I use that mapeditor, but usually export it to json. Actually exporting it to json is what you need. It has a "data" attribute which is an array of numbers like you have above, and each number represents a tile.

Member Avatar for mrnutty
0
112
Member Avatar for mrnutty

Hey guys, haven't been on here for a while. Just thought, I'd get the ball rolling and interact with the community. Anyways, tell me and everyone else on the internet, the derivation of your username? Why? How? What? When? Who? WTF?

Member Avatar for Reverend Jim
0
687
Member Avatar for mikerock

I'm using Phaser engine for a 2d web platformer game, its not too bad, give it a shot

Member Avatar for mrnutty
0
137
Member Avatar for michelle.trinsky

Can you just use notepad search/replace to format the csv file? or is this just for practice

Member Avatar for mrnutty
0
4K
Member Avatar for boogeyman77

let me start you off. This snippet generates prime up to 100. Fill in the conditions. Its in java...hehe. So you need to understand the logic and convert it. Then you can fill in the needed requirements. [code] package helloworld; public class Main { static boolean isPrime(int num) { if(num …

Member Avatar for Mahfuz_1
0
640
Member Avatar for owen99

[QUOTE=ShawnCplus;507456][code=c++] #include <iostream> #include <cstdlib> #include <ctime> #include <string> using namespace std; int main() { srand ((unsigned) time(0) ); //<----Only seed once //A string is not necessary, you aren't using any the facilities of the class char* RandNum; //What is this supposed to do? There's no input from the user? …

Member Avatar for Anilorap
0
1K
Member Avatar for pipsy17

Else statement is connected to the if statement. Once the if statement is executed, else statement is not executed even if the while statement inside the if returns false or true or never returns.

Member Avatar for mrnutty
0
237
Member Avatar for luislupe

Try this ` cout << " just inserted new element. " << (ret.second==true) << endl;` or better yet just `cout << " just inserted new element. " << ret.second << endl;`

Member Avatar for mrnutty
0
2K
Member Avatar for TuteePink

Usually you overload the operator[] for constant-ness. Are those operators defined in some class? Consider these statement T* a = getA(); const T*b = getB(); if(a[0] == 1) doA(); if(b[0] == 1) doB(); Without the `const T& operator[](int)const` version, the `b[0] == 1` would not compile because b is declared …

Member Avatar for mrnutty
0
150
Member Avatar for nychick

Use [URL="http://www.cplusplus.com/reference/clibrary/cctype/toupper/"] toupper[/URL] function in cctype header file.

Member Avatar for Rogierownage
1
918
Member Avatar for GrimJack

Interesting history post. Thanks for the information. Off topic kinda but I wish more people would just stop what they are doing for 5 minutes and just observe. Observe the society, observe the body languages, observe the human interaction, observe nature and its wonderful mathmatical creation, observe people and their …

Member Avatar for GrimJack
1
197
Member Avatar for omarking05

Be nice. So you want to alternate rotation. In that case you need a little bit more logic like so: if( isSpaceKeyPressed()){ int currentRotation = line.getRotation(); if(currentRotation == 90){ //is horizontal( flat line ) line.setRotation(0); //make it straight line }else{ line.setRotation(90); //make it flat line } }

Member Avatar for Ancient Dragon
0
258
Member Avatar for Awais Ali

What will knowing that data structure FB used will help you in anyway? If you have a problem of picking which data structure to use, then either post it here or compare the pro's and con's of each data structure and pick the one that best suites the problem. They …

Member Avatar for BigBang@12
0
833
Member Avatar for Spanky_12

Maybe this startup hint would help you #include <iostream> using namespace std; void getMonthsData(int data[], const int SIZE){ //print message //for i = 0 to size //ask for data[i] } void getYearData(int data[], const int SIZE){ //print message //for i = 0 to size //ask for data[i] } void getAverate(int …

Member Avatar for mrnutty
0
245
Member Avatar for tformed

I am not saying its faster than sqrt, but it calculates it without using sqrt. [code] sqrt(a) = x x^2 = a ln(x^2) = ln(a); 2ln(x) = ln(a) ln(x) = ln(a) / 2 x = e ^ (ln(a)/2) //same as sqrt(a); //you can decompose it back to sqrt like so …

Member Avatar for vmanes
0
3K
Member Avatar for murnesty

Member functions are not the same as regular functions. There is a little more work, here is an example: class SampleClass { public: int plusfunc (int a, int b); }; int SampleClass :: plusfunc (int a, int b) { return a + b; } typedef int (SampleClass::*functor3) (int a, int …

Member Avatar for mrnutty
0
258
Member Avatar for firebird102085
Member Avatar for Xorlium

Is this operation being performed on Actors only? Do you have a list of Actors available to apply the filtering?

Member Avatar for mike_2000_17
0
205

The End.