J Hiddleston

Greenhorn
+ Follow
since Apr 03, 2018
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by J Hiddleston

J Hiddleston wrote:

John Matthews wrote:Hi J - is it that you don't understand (1) what it is you have to do, or (2) how to do it?

I worked on it some more, and thought I had found a way to make it work for these two searches, but am not getting the correct values. Any ideas why?

3 weeks ago

John Matthews wrote:Hi J - is it that you don't understand (1) what it is you have to do, or (2) how to do it?

If it's (2) then have you got some code to show us how far you've got? That would make it a lot easier for us to help.



Somewhat of a mix of both. I had seen an example of how to do the depth-first search online, which I will post below.



But it takes in different parameters than what is listed in my requirements, and so I am not sure if I could implement something similar to this or not.

I'm quite new to C, so some of my questions may be simple, or I may not understand all concepts so I apologize.
3 weeks ago

Campbell Ritchie wrote:No, he means the forum. Nil desperandum; I shall move you to our C forum in a few seconds.



Thanks!
3 weeks ago

Tim Holloway wrote:

J Hiddleston wrote:This shows it is posted in Java but I cant seem to change it?



Are you referring to the code tags? That's no problem. The option on the code tag just tells us how to colorize the display and Java and C and C++ are all similar enough to use basically the same option.



Oh okay, I wasn't sure, thanks!
3 weeks ago
This shows it is posted in Java but I cant seem to change it?
3 weeks ago
Hi, I've been tasked with making a Binary Tree program with particular functions. I have been able to make most of them, but am having trouble with a few. I will post what I have below, and also the required functions remaining. Any help is appreciated, thanks!



Attatched is a photo of the remaining function structures.
3 weeks ago

Tim Holloway wrote:C is not java. If you don't set an initial value on a variable, chances are you will get garbage. Garbage shifted is still garbage.



I changed it to this :
ic = ic << offset;

I am no longer getting errors but my output is still incorrect. Any ideas?

1 month ago
Thank you for the answers, I've attempted to use the shift with the equals but am getting this error :

main.c: In function ‘encrypt’:
main.c:27:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<<=’ token
    int ic <<= start;
           ^~~

I'm not sure what I am doing wrong, sorry.
1 month ago
I need to create a program that takes in two ints, and a start character, and "encrypts them" by reversing the characters binary representation, converting that to an integer, left shifting the int by the first given integer, and right shifting the int by the second given integer, and then returning the value. The program must then take a cipher value and undo the encryption based on two given ints for the shifts. This is what I have so far and it makes sense in my head but is not working in practice.



Any help is appreciated, thanks!
1 month ago

Junilu Lacar wrote:Wouldn't an "example of how to do this" actually be doing the work for you? People usually post the code they've written and ask for feedback. What have you tried so far?



I have tried this, but as I said it was using putchar which prints the line out which is not allowwed.

1 month ago
Hi, I am trying to write a function in C that takes a single character, converts it to binary, and then reverses the order of bits. I had originally tried it using putchar, but the function is not allowed to print anything, simply return the reversed bits. I am wondering if anyone is able to offer any help, or provide an example of how I could do this, thanks! This must be done with bitwise operations.

**Also if this is not posted in the correct spot please let me know, I wasn't sure where else to post, thanks!**
1 month ago

Stephan van Hulst wrote:You're splitting the string on space characters, but your input doesn't contain spaces.



Sorry, I understand this, just wasn't thinking when writing that part of the post.
I am entering inputs as follows, " one two three four five six" etc...
Apologies for not cluing in whilst writing.
1 month ago
Hi, I'm having an issue with a stack program I wrote, if I enter 3 inputs for a string, EX: "one, two, three, quit" (quit is how all inputs are to end and doesn't get added to the stack) the program works totally fine.
But when I put more inputs, EX:"one,two,three,four,five,six,seven,eight,nine,quit" It doesn't printout all the values, for example, prints from "nine" to "three" but doesn't print "one" or "two".
Probably just a simple mistake, but I can't seem to find out why this is happening, any help is appreciated!

I will post the class and tester class I am using:






1 month ago
Hello,
I have made a number that computes the nth prime, but need it to be more efficient. The outputs are correct however the calculation is slow for large numbers (10000th prime number for example).
I am wondering if anyone has any ideas to increase efficiency?

2 months ago

Chris R Olsen wrote:Hi, Joel --

 The mathematician in me says that you have not adequately coded what you mean by the lowest possible index.  All your code does is find the max number.   If what you want is the lowest possible index that is one of many that have the max value, you need to add that in your loop.  Perhaps have the loop iterate _DOWN_ and say,...



 -- Chris



I may have misunderstood what you meant, but when I changed my code to this I didn't get the proper answer.
I should get an answer of index 3 being the max with the lowest index, however it returned 1.
1 year ago