6 Posted Topics
Re: It's not even C# (should have been System.Console.WriteLine), it's a combination of static function call from C++ with objects from C#. How Moschops said ... go with cout. | |
Re: I don't quite understand why you need to store each int in a array. Wouldn't it be simpler to have a single array of int's? Anyway, if you want it like that you can use a pointer to a array of int arrays. Then you can use each array by … | |
Re: Here is a nifty way of doing it: int* DecToBin(int n, int* output) { if(n == 0) return &(*output = 0); if(n == 1) return &(*output = 1); output = DecToBin(n / 2, output); return &(*(++output) = n % 2); } in the output field put a array of int's … | |
Re: Just use this: double calc_pi(int nrDigitals) { double a = 1; double b = 1 / sqrt(2); double t = (double)1 / 4; double p = 1; double temp_a; double temp_b; for(int i = 0; i < nrDigitals; ++i) { temp_a = (a + b) / 2; temp_b = sqrt(a … | |
Re: It's simple, first, you initialize the values with 0 and 1 to have valid input in case strok fails. Then you call strtok to parse the input that you get from the constructor as a char pointer. Strok is a function that splits C - string based on a delimiter(also … | |
Re: Of course, you can output the data in a file instead of console and also get the data fron the console instead of generating it! #include <iostream.h> #include <cstdlib.h> int f91(int n) { if(n >= 101) return (n - 10); if(n <= 100) return f91(f91(n + 11)); } int main(int … |
The End.