Forum: C 5 Days Ago |
| Replies: 5 Views: 272 First make a palindrome that is case and punctuation sensitive :
You code revised a little :
#include <string.h>
bool palindrome (const char *s)
{
int index = 0, length = 0;
length =... |
Forum: C 7 Days Ago |
| Replies: 1 Views: 206 Sure :
//declare char *password = "hello";
//ask user for the password
//check if( strcmp(userInput,password) == 0 )
//if so the let him through
//else exit program |
Forum: C 8 Days Ago |
| Replies: 3 Views: 483 You don't. You let the pro handle it, ahem, ahem. |
Forum: C 9 Days Ago |
| Replies: 4 Views: 322 <quote>So basically I want to be able to stick a few zeros in front of the smaller binary numbers.
Check the length, while(binary.length mode eight != 0 ) addToFront('0'); |
Forum: C 10 Days Ago |
| Replies: 2 Views: 256 You need to check through every element in the array to ensure that there is no repetition right ? So if the array was of size n, then to ensure that there is no repetition inside the array, you need... |
Forum: C 11 Days Ago |
| Replies: 4 Views: 254 Wow over 500 lines for a determinant. Maybe you should be a teacher?
Seriously, I wouldn't want use that function to calculate the determinate, becuase I would have to do this :... |
Forum: C 13 Days Ago |
| Replies: 7 Views: 381 They didn't like that one either. |
Forum: C 13 Days Ago |
| Replies: 4 Views: 290 aww man. I though some n00b came up with this title. I should have
known. This is funny though. |
Forum: C 13 Days Ago |
| Replies: 7 Views: 314 >>But this looks ugly and I had to use a separate variable.
I think that looks beautiful. In fact you can just make a function that does that, and so it will be in a sense a one liner.
I don't... |
Forum: C 15 Days Ago |
| Replies: 7 Views: 381 In c ( or C++) : 0 is false, and any other number is true. |
Forum: C 17 Days Ago |
| Replies: 6 Views: 390 This (http://gmplib.org/) is a good library. Try inputting 500!
in their sample program and see what you get.
P.S : its factorial and not fectorial |
Forum: C 20 Days Ago |
| Replies: 3 Views: 381 You need to do a little more :
int LoadBitmap(const char* filename)
{
GLubyte* pixels;
HBITMAP hbmp;
BITMAP bmp;
GLuint size;
GLenum format; |
Forum: C 23 Days Ago |
| Replies: 4 Views: 2,739 You put (Nov 28th 2009):
He put ( Jul 16th, 2004 ):
See the problem? |
Forum: C 23 Days Ago |
| Replies: 1 Views: 350 don't use the sqrt function. compare the squared distance. |
Forum: C 24 Days Ago |
| Replies: 2 Views: 272 Yep, not unless you obscure the meaning of "sorting". |
Forum: C 26 Days Ago |
| Replies: 1 Views: 486 Disregarding the header and the bottom of the table and just
considering the inside of the table you can simply just do this :
for(int i = Max; i >= Min; --i){
//print i
... |
Forum: C 27 Days Ago |
| Replies: 12 Views: 768 You have 1 extra comma in your array initialize list.
And this code :
char i = rand(letters[i]);
is wrong. rand does not take anything it its parameter.
This is how to use it. |
Forum: C 28 Days Ago |
| Replies: 12 Views: 768 Did you try that out ? I see problems with that. |
Forum: C 33 Days Ago |
| Replies: 12 Views: 768 >>PS: i already searched on the internet
Then obviously you haven't searched at daniweb.
Anyhow, do you first know how to generate a number from a min to max? |
Forum: C Nov 16th, 2009 |
| Replies: 4 Views: 456 If practice is what you want then
google1 (http://hkn.eecs.berkeley.edu/~dyoo/cs3/recursion-problems.pdf)
google2 (http://hkn.eecs.berkeley.edu/~dyoo/cs3/recursion-problems-2.pdf) |
Forum: C Nov 16th, 2009 |
| Replies: 9 Views: 396 Its undefined, google sequence points.
Aia I like your avatar. |
Forum: C Nov 14th, 2009 |
| Replies: 2 Views: 660 You could sort the array and the check if adjacent values are the same. |
Forum: C Nov 14th, 2009 |
| Replies: 8 Views: 557 Also, if the numbers aren't too far apart, then what you could do
is get the average of the 3 numbers, and find the number that is closest
to the average. This will work long as the number aren't... |
Forum: C Nov 3rd, 2009 |
| Replies: 2 Views: 207 You mean the input is something like this ?
<enter fraction > 123/452
And its read as a string.
If so then separate the string into 2 components the left side before the '/' character... |
Forum: C Oct 26th, 2009 |
| Replies: 1 Views: 208 Sounds like H.W. Try googling it up, and read a couple articles and
post what you think the answer should be, and from there we could determine if you got it( from our opinion) |
Forum: C Oct 26th, 2009 |
| Replies: 3 Views: 171 So by now you should know that you need nested loop, right?
since there are 3 rows, your outer loop should go up to 3.
Now for your nested loop. What you can have is have 2 for loop inside the ... |
Forum: C Oct 26th, 2009 |
| Replies: 3 Views: 171 * * * * * # # # 1
* * * * # # # # 2 ROW
* * * # # # # # 3
realize that there are 5 '*' the 4 '*' then 3 '*' after each line.
On the other side, there are 3 '#', then 4 '#' then 5 '#'.
What... |
Forum: C Oct 16th, 2009 |
| Replies: 5 Views: 301 Haven't tested it yet, but it could be similar to this :
int M = 5;
int i = 1;
while(i <= M) cout << i++ <<" "; //print from 1 to 5
while(--i > 0) cout << i << " "; //print from 4 to 1 |
Forum: C Oct 13th, 2009 |
| Replies: 14 Views: 512 Actually there is only 1 index, which is 0 in char A[1];
A[0] = 'a'; //ok
A[1] = 'b'; //bug |
Forum: C Oct 5th, 2009 |
| Replies: 5 Views: 442 what exactly do you mean by distinct prime factor? |
Forum: C Oct 3rd, 2009 |
| Replies: 3 Views: 269 Get started.
int main()
{
//Create array
//use a for loop to ask user for input
// for i from 0 to array size cin >> myArray[i];
//create a sum,average, high and low... |
Forum: C Oct 2nd, 2009 |
| Replies: 5 Views: 698 |
Forum: C Sep 29th, 2009 |
| Replies: 2 Views: 384 Create two int variable.
Ask user for input
Check if input is valid
if so the proceed else go back to get user input
start a for loop from i = 0; i < L;
start another loop ( nested loop ) that... |
Forum: C Sep 29th, 2009 |
| Replies: 2 Views: 182 sort the array.
And from there see which value occurs the most. |
Forum: C Sep 18th, 2009 |
| Replies: 11 Views: 430 Yes, structure goes by units of 4. |
Forum: C Sep 18th, 2009 |
| Replies: 8 Views: 618 int cnt = 0;
for infinite loop
{
//do stuff
if(//do stuff is what i need) // then break;
else cnt++;
//if cnt is above the limit then break;
} |
Forum: C Sep 17th, 2009 |
| Replies: 17 Views: 579 sizeof(array)/sizeof(double) ? |
Forum: C Sep 14th, 2009 |
| Replies: 7 Views: 905 This thread is hilarious. |
Forum: C Sep 14th, 2009 |
| Replies: 8 Views: 685 Have a left, middle, and end variable. Make middle static.
Move left up 1, move end down 1. If left == mid || right == mid then stop. |
Forum: C Aug 31st, 2009 |
| Replies: 19 Views: 1,032 @OP : is the God dam a typecast to pointers, because you hate them? |