Search:

Type: Posts; User: deadrabbit

Search: Search took 0.01 seconds.

  1. Replies
    1
    Views
    4,177

    Project Euler 22

    I'm having a bit of an issue with my solution to Euler problem 22. I have a list of names that are surrounded by quotation makes and separated by commas (I.E. "MARY",). I have created a function...
  2. Replies
    2
    Views
    10,567

    Pointer to 2d Array

    #include <stdio.h>

    int main()
    {

    int dat[20][20] = {
    {8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5 ,7 ,78 ,52 ,12 ,50 ,77 ,91 ,8},
    {49 ,49 ,99 ,40 ,17 ,81 ,18 ,57 ,60 ,87 ,17 ,40 ,98 ,43 ,69...
  3. Replies
    6
    Views
    6,643

    I reworked the problem using these optimizations...

    I reworked the problem using these optimizations for the algorithm and the results were far more acceptable. However, I suppose its good to get a handle on threads sooner than later.
  4. Replies
    6
    Views
    6,643

    Thank you cas and anduril, for your advice. I...

    Thank you cas and anduril, for your advice. I will look into pthread_join() and implementing mutexes. Anduril, I wasn't sure how to do a loop when initializing the threads to call different...
  5. Replies
    6
    Views
    6,643

    Euler Problem 10 With pthreads

    I'm trying to implement threads with Project Euler problem 10. I am getting different results for the sum of the primes every time I run the program. I realize the code is quite atrocious; this is my...
  6. Replies
    1
    Views
    1,749

    system function input from array

    I have the path to an MP3 stored in an array and would like to append it to a command passed to system().



    system("mplayer FILE")


    How might I be able to enumerate the contents of the...
  7. Replies
    2
    Views
    8,870

    Project Euler Problem 8

    I'm having a bit of trouble solving this problem. The objective is to find the largest product of five consecutive digits in this 1,000 digit number.


    #include <stdio.h>

    int main(void)
    {...
  8. Replies
    5
    Views
    3,391

    Thanks Salem, that sorted it.

    Thanks Salem, that sorted it.
  9. Replies
    5
    Views
    3,391

    strlen inconsistency

    #include <stdio.h>
    #include <string.h>

    int main(void)
    {
    char *num = "73167176531330624919225119674426574742355349194934\
    96983520312774506326239578318016984801869478851843\...
  10. Replies
    1
    Views
    4,257

    Palindromic numbers problem

    I wrote a program to find the largest palindromic number one could produce as the product of two three digit numbers.



    int main (void)
    {
    int i, j, z;
    int num;
    char buf[6];
    char...
  11. Replies
    6
    Views
    4,653

    I figured it out; were swapping the first and...

    I figured it out; were swapping the first and last elements, then second and second to last element, etc. which means that we only need to go half way through the array to reverse the elements.
  12. Replies
    6
    Views
    4,653

    It is supposed to reverse the contents of an...

    It is supposed to reverse the contents of an array, that is take 4689 and turn it into 9864, using XOR operations.

    I found the algorithm here...
  13. Replies
    6
    Views
    4,653

    Reverse contents of array

    I found this algorithm to reverse the contents of an array-

    int len=strlen(word);
    for (int i=0;i<len/2;i++)
    {
    word[i]^=word[len-i-1];
    word[len-i-1]^=word[i];
    ...
  14. Replies
    6
    Views
    24,006

    Ahh, I see. Thank you all.

    Ahh, I see. Thank you all.
  15. Replies
    6
    Views
    24,006

    sum of multiples of 3 or 5 below 1,000

    I wrote a program which should compute the sum of all of the multiples of 3 or 5 below 1,000.

    int main()
    {
    int sum = 0;
    int i;


    for (i=0; i < 1000; i++)
    {
  16. Replies
    4
    Views
    2,449

    Thanks! That fixed things up.:biggrin:

    Thanks! That fixed things up.:biggrin:
  17. Replies
    4
    Views
    2,449

    Odd results on user input array

    More of less on a whim I decided to write a program to convert matrices into row echelon form. To start off, I wrote a program that took numbers from the user and wrote them into a matrix, then...
  18. Replies
    12
    Views
    4,333

    Duly noted

    Duly noted
  19. Replies
    12
    Views
    4,333

    AndrewHunter, an algorithm like that sounds a...

    AndrewHunter, an algorithm like that sounds a little bit out of my depth at the moment :(; I will look into sleep system calls as CommonTater suggested. Im running FreeBSD 8.2 and I compile with gcc...
  20. Replies
    12
    Views
    4,333

    Incongruous CPU usage?

    Ive written an alarm clock program which now function as it should. However, when I look at the process list in top, I see that the alarm program is using 100% of one of my processor cores capacity....
  21. Replies
    3
    Views
    5,825

    Alright, thanks guys. I knew I was making this...

    Alright, thanks guys. I knew I was making this more complicated then it should be. :rolleyes:
  22. Replies
    3
    Views
    5,825

    Convert time difference into seconds?

    I am writing an alarm clock program. Basically, it takes a time from the user and converts the difference between that time and the current into seconds. However, this function only returns the...
  23. Replies
    4
    Views
    4,242

    Thanks KCfromNC, that helped to clarify things...

    Thanks KCfromNC, that helped to clarify things for me somewhat :cool:
  24. Replies
    4
    Views
    4,242

    struct tm confusion?

    I am attempting to write a alarm clock which receives input from the user. My initial design was to have the user fill out the tm structure by hand. I found two different examples of this and am a...
Results 1 to 24 of 24