Posts
 
Reputation
Joined
Last Seen
Ranked #592
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
~21.2K People Reached
Favorite Forums
Favorite Tags
c++ x 55
c x 2

38 Posted Topics

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
678
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
156
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
94
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
158
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
168
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
105
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
123
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
183
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
96
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
170
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
161
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
310
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
108
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
102
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
89
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
70
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
368
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
285
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
98
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
159
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
129
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
112
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
174
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
287
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
127
Member Avatar for Gaytri Khanna

You can read about the main() function [URL="http://msdn.microsoft.com/en-us/library/3ze4ytsc(VS.80).aspx"]here.[/URL]

Member Avatar for BevoX
0
206
Member Avatar for serkan sendur

[CODE=C++] #include <iostream> using namespace std; int a = 3; int b = 4; int c = 5; int * pA = &a; int * pB = &b; int * pC = &c; int *abc[] = { pA, pB, pC }; int main() { cout << *abc[0] << endl; return …

Member Avatar for BevoX
0
72
Member Avatar for massivefermion

[CODE=C++] double a[start-end][2],p[start-end]; cout<<"Enter a number to begin with : "; cin>>start; cout<<"Enter a number to finish with : "; cin>>end; [/CODE] You are using 'start' and 'end' without being initialized. Give start, and end a value before using them. [CODE=C++]if(start==end || start>end)[/CODE] I think this would work the same. …

Member Avatar for massivefermion
0
386
Member Avatar for mruane

I would recommend a site [URL="http://www.3dbuzz.com/vbforum/sv_home.php"]3Dbuzz[/URL] , it has some nice video tutorials, fun to watch, and covers the very basics of C++. If you find the resolution a bit low, you could try to find it in some torrent sites.

Member Avatar for Stefano Mtangoo
0
162
Member Avatar for dannybarh

[QUOTE=dannybarh;777054]i need a random generator. it should be able to generate serial #s along side. any website in mind? please help.:yawn:[/QUOTE] How about, this thread [URL="http://www.daniweb.com/forums/thread1769.html"]http://www.daniweb.com/forums/thread1769.html[/URL] ?

Member Avatar for StuXYZ
0
137
Member Avatar for AdRock

You should consider using a vector, or a list instead of bothering with an array. It would be much easier. Read the whole file line by line in a temporary string then push it back into the vector. Iterate through the vector and you will get all of the lines …

Member Avatar for BevoX
0
161
Member Avatar for guest7

Yes you can. You could use an fstream for example, that would be the easiest way to do it. Or you can use an ifstream reading the file, then an ofstream to modify it. Move the pointer (seekp) to the desired location and start writing out your data. You can …

Member Avatar for Comatose
0
526
Member Avatar for BevoX

I have a rather simple question, and I' ve been looking for the answer for awhile, but did not find any. So I would like to know, what is the proper way of deleting a pointer. For example I have a class with some kind of array, which I want …

Member Avatar for BevoX
0
122

The End.