Posts
 
Reputation
Joined
Last Seen
Ranked #590
Strength to Increase Rep
+6
Strength to Decrease Rep
-1
84% Quality Score
Upvotes Received
6
Posts with Upvotes
5
Upvoting Members
5
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
4 Commented Posts
~20.9K People Reached
Favorite Forums
Favorite Tags
c++ x 55
c x 2
Member Avatar for rock9449

[QUOTE=Ancient Dragon;841451]First do the math on paper & pencil. Once you get that right then coding it will be simple. If the hours is greater than 12 just subtract 12 and the A.M./P.M. flag will be 'P'. Otherwise if the hours is less than 12 the flag will be 'A' …

Member Avatar for deceptikon
0
8K
Member Avatar for BevoX

This is my solution for generating prime numbers. With this code hopefully you can generate prime numbers with incredible speed. The generated numbers will be stored in a text file titled as "Primes.txt". I have a dual core machine, but this program does not support dual core architecture, so it …

Member Avatar for Microno
1
674
Member Avatar for BevoX

Alright no more prime number generators I promise, but I had to fix the last one... This one uses the Sieve of Eratosthenes algorithm. It can generate prime numbers even faster, than the previous version. 1 million prime number in 2,331 second, ten million prime number in less than 22 …

Member Avatar for KumarUtkarsh
0
155
Member Avatar for BevoX

Greetings! So my question is: Is it possible to create your own data type? Not a class, or a structure, that builds from predefined C++ types, but your very own. For example a 128bit integer type, or a very very long floating point data type, or a binary number type …

Member Avatar for maf5693
0
4K
Member Avatar for jediahsan

Try to avoid recursive functions if you can, they can slow your program greatly.

Member Avatar for Abinet yilma
0
91
Member Avatar for vsha041

Without getting into details. When you compile your code, the compailer (most compailers) give you 2 exe files. The one in the "Debug" folder, and another one in the "Release" folder. You need the exe file from the "Release" folder. Oh, OK I just read tux's comment. Yeah, that is …

Member Avatar for tux4life
0
157
Member Avatar for coder101

I think Lerner gave you a very nice explanation. What you need is another loop. You can't do this with a single loop. You need a nested loop inside your loop. In my opinion there are two solutions for you: The first one is: you make a loop for each …

Member Avatar for WaltP
0
164
Member Avatar for Dontais

Try with this. [code=C++] // change this in your class declaration friend istream& operator >> ( istream &, Date & ); istream& operator >> ( istream &in, Date &myDate ) { cout << "Enter three integers for day, month, year: "; in >> myDate.day >> myDate.month >> myDate.year; return in; …

Member Avatar for BevoX
0
103
Member Avatar for I-R

Try to avoid, system( "pause" ); if you can. It works only for windows, and it needlessly calls a DOS/Windows command. Try cin.get(); instead. Another thing you are making blocks for no reason. Making the impression each block is a branch, and after that your program will behave differently. Well …

Member Avatar for tux4life
0
119
Member Avatar for lauren316

[code=C++] Fraction::Fraction(int, int) { int num; int denom; enterFractionValue();/// gets use to input fraction if(denom == 0) // checks to see if denom = 0 { num = 0; denom = 1; // forces a 1 to the denominator } if (num == " " && denom != " " …

Member Avatar for daviddoria
0
181
Member Avatar for C++ Obliviator
Member Avatar for mrtsoftware

Yeah, but this is a C++ forum. :) Little help: 1 hour = 60*60 seconds = 3600secs. First you have to store the amount of seconds that can't be converted to hours. 8230 % 3600 = 1030. You store the reminder in a temporary variable, then divide 8230 by 3600. …

Member Avatar for mrtsoftware
0
90
Member Avatar for arshad115

[code=C++] #include <iostream> using namespace std; int main() { char ** my_arrays; my_arrays = new char * [10]; // after this you will have 10 "arrays" - pointers my_arrays[3] = new char [10]; // allocate memory for the 4th array - 10 characters for my_array[3]; - 9 can be used …

Member Avatar for tux4life
0
2K
Member Avatar for arshad115

[code=C++] #include <iostream> using namespace std; void b( char** p ) { *p = "some text"; } int main() { char *p = new char [20]; b( &p ); cout << p << endl ; cin.get(); return 0; } [/code] But, isn't it wiser to pass the pointer by reference? …

Member Avatar for vmanes
0
168
Member Avatar for JameB

Have you tried to use a vector? You can only get the capacity of the array by this: [code=C++]sizeof( iarray ) / sizeof( int )[/code]

Member Avatar for arshad115
0
156
Member Avatar for DemonGal711

You have to delete all the branches of the tree you've allocated. You use delete to get rid of a single block of data. And delete[] - to get rid of an array of data. And if you just delete[] the root, the other branches would remain there. Maybe you …

Member Avatar for DemonGal711
0
303
Member Avatar for xonxon

When you are dealing with pointers for the first time, it might be confusing, when do you need to put a star in front of a variable, and actually what it means. int* p - is a pointer of type 'int'. It can hold an address of type 'int'. So …

Member Avatar for BevoX
0
103
Member Avatar for shankhs

How about both? You can't create programs without algorithms. Algorithms are essential tools for programming. If you want to develop a program, or solve a particular problem, you will have to need an algorithm. You can use algorithms of others, or you can come up with your own. But still, …

Member Avatar for shankhs
0
98
Member Avatar for rose_lod

[QUOTE=ithelp;815368]Just choose an index randomly and swap( i ,lengh-i+1) position[/QUOTE] [code=c++]swap(i, length - (i + 1) )[/code] But don't forget the brackets, because you would get some very funny results, especially with index 0 and 1. :)

Member Avatar for BevoX
0
85
Member Avatar for xonxon

Computer::Computer() - This is a constructor with no parameters of the class "Computer". A constructor has the same name as its class has. // This is how would look like a constructor with a parameter. For example.[code=C++]Computer::Computer( int )[/code] A constructor is special function called, when the object is being …

Member Avatar for xonxon
0
67
Member Avatar for tux4life

[URL="http://www.codeguru.com/cpp/cpp/cpp_mfc/pointers/article.php/c4089/"]http://www.codeguru.com/cpp/cpp/cpp_mfc/pointers/article.php/c4089/[/URL] This link might be useful.

Member Avatar for tux4life
0
366
Member Avatar for scias23

I don't get it. What's the point of duplicating the source array in a reverse order? You can check the beginning and the ending of the array at the same time. And you can still use the array's indexing method with strings to compare each character to another. [code=C++] #include …

Member Avatar for jencas
0
283
Member Avatar for blerina12

And what about white spaces and new lines? You are stuffing all the characters, one by one in a temporary character, but by doing that you are losing all the new lines and white spaces. Therefore you will get an unreadable stream of characters. It would be better to read …

Member Avatar for blerina12
0
95
Member Avatar for rohit joshi

Yeah I vote for Code::Blocks too! :) Another thing, if you really want to do a favor for yourself, consider only those environments which has a debugger. It is an incredibly powerful tool. You will C :)

Member Avatar for jbennet
0
155
Member Avatar for Sky Diploma

You start dividing every number by 1! Every integer can be divided by 1 without remainder. Therefore you will always get "false" from your is_prime(int) function. Secondly, you are going to overflow your int value. There are thousands of prime numbers in between 1 and 2000000. And their sum is …

Member Avatar for Sky Diploma
0
127
Member Avatar for sarifah

[URL="http://www.cplusplus.com/doc/tutorial/operators.html"]http://www.cplusplus.com/doc/tutorial/operators.html[/URL] [URL="http://www.cppreference.com/wiki/operator_precedence"]http://www.cppreference.com/wiki/operator_precedence[/URL]

Member Avatar for sarifah
0
110
Member Avatar for En-Motion

I recognize this code, this is from 3DBuzz's tutorial. :) You did not declare the default constructor in your class. In other words you do not have declaration for the constructor with no arguments. Watch the 'public section' closely.

Member Avatar for En-Motion
0
1K
Member Avatar for vivekc++

Try this: [code=C++] for( list<int>::iterator itr = dob.begin(); itr != dob.end(); itr++ ) { cout << *itr; } [/code] I am not sure about the starting expression of the for loop, but as far as I know. You can declare as many arguments as you want to, as long as …

Member Avatar for Ancient Dragon
0
172
Member Avatar for flip.phinoi

Put your code in between a do - while statement. Like this one: [CODE=C++] #include <iostream> #include <conio.h> using namespace std; int main() { int loop = 0; do { cout << "This is the " << loop << ". run." << endl; loop++; cout << "Do you want to …

Member Avatar for WaltP
0
265
Member Avatar for alphabetanm

mPayment = (P*i)/q((1-pow((1 + (i/q)),-t))); Didn't you forget to put a * after q? By the way it gives back 323,406.

Member Avatar for alphabetanm
0
124