Latest Software Development Posts

Yes. The programmer reads the code, and either writes the new app or tries to convert it line by line.

Said programmer would have to work at it but once in a while you find one that is looking for a cheap fast exit.

.

Line 2 at the end did say "Binary". Is there any mystery here Shaggy?

Hello Everyone,

I'm trying to create / edit a binary value within the windows registry so far I have this:

  Dim data As Byte() = New Byte() {&H48, 96}
        Microsoft.Win32.Registry.SetValue("hkey_local_machine\hardware\description\system\bios", "SystemProductName2", data, Microsoft.Win32.RegistryValueKind.Binary)

However, I want to set a product name say "Acer Stuff" to the registry and what is happening it will not print the characters. I'm getting numbers. Any suggestions? I've searched for a few hours to get this done and I'm having a difficult time. Any help would be greatly appreciated.

Thanks.

I apologise for not commenting on what I wanted your help for my code and to expect too much from your perspective. I've played around with my code and have found the answer that I was looking for.

I am grateful for all the help that you have given me, and I apologise once again for being unprofessional.

Thank you JC for that. While it's been accepted to use "they" for gender neutral, I failed to resolve for the single or multiple deity point of view.

I have to run now as I see torch lights by the windows. The sound of the tines of the pitchforks was soothing.

only God knows and they are not talking to me at the moment.

Presuming that you are using "they" as a gender-neutral pronoun, then shouldn't that be "they is not talking to me"?
It sounds so wrong, but it's logical.

If, on the other hand you are referring specifically to the Christian 3-in-1 god, then "are" could be correct.

rproffitt commented: And I didn't account for the no-diety scenario. For that, they are truly on their own. +15

In regards to your last post. Your code is uncommented so while you and God knows what you expect, from my view, only God knows and they are not talking to me at the moment.

So I'll have to not look at that code and simply write you might be asking how to add two or more arrays to have a third array then plot that.

This is what I have

{
    int k, n, x, y;
    int sum;

    printf("Enter the number of Wave: ");
    scanf("%d", &k);
    printf("Plotting Graph...\n");
    n = 2 * k - 1;

    int a = 0;
    int b = 255;
    int c = 0;

    do
    {
        for (x = 0; x < W; x++)
        {
            y = H / 2 + H / 3 * 4 / pi * (sin(2 * pi * n * x / T) / n);             
            rgb_data[y][x][0] = a;
            rgb_data[y][x][1] = b;
            rgb_data[y][x][2] = c;

        }
        n--;
        n--;
        a = a + 30;
        b = b + 80;                     //Plots graph in different colours every run
        c = c - 64;
    } while (n >= 1);
    {
        imgwrite();
        for (x = 0; x < W; x++)
        {
            sum = 0;
            for (n = 1; n < k + 1; n++)
            {
                y = (H - 1) / 2 * sin(2 * pi * (2 * n - 1.0) * x / T) / (2 * n - 1.0);          
                sum = sum + y;
            }
            sum = (H / 2) + sum;
            rgb_data[sum][x][0] = a;
            rgb_data[sum][x][1] = b;
            rgb_data[sum][x][2] = c;
        }
    }
}

I need help to plot the square wave of the graph.

Hi! You can use ZetExcel.com. It is very helpful.

rproffitt commented: What happens when your homework is late? -3

Do you know how to do a sum of the waves and plot it as a graph?

Thank you. I really appreciate it

I gave you the basic gist of the loop till exit.

{
    bool something = true;
    do {
       something = stuff(); // stuff() does stuff and returns false when done.
       }
   while ( something );
   return 0;
}

Tutorial: https://www.tutorialspoint.com/cplusplus/cpp_do_while_loop.htm

Sorry but this time I will not code it up and supply it running in an online compiler. You must develop those muscles.

Can I have a pseudo code for that? I'm not too sure how to go about it

Maha
Your rude demand for someone to drop whatever they are doing and do your homework for you is attached to a 10 year old dead topic. so 0/10 for post quality.

Think on your mistakes, start your own new topic and show some courtesy and some effort, then maybe someone will want to help you.

I need a program of five integer in ascending oder with if condition
plz reply fast

rproffitt commented: Please start a new question. Also, if you need it fast, how much are you paying? -3

I need to transfer java code to phyton.
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    int[] hours = new int[n];
    if (n <= 31) {
        inputHours(hours,n,sc);
        workedHours(hours,n);
    }
}

private static void workedHours(int[] hours, int n) {
    int sum = 0;
    for (int i = 0; i < hours.length; i++) {
        if (hours[i] != 8 && hours[i] > 8) {
            sum += hours[i] - 8 ;
        }
    }
    System.out.println(sum);
}

private static void inputHours(int[] hours, int n, Scanner sc) {
    for (int i = 0; i < hours.length; i++) {
        hours[i] = Integer.parseInt(sc.nextLine());
        System.out.println(hours[i]);
    }
}

Hi, Jerry, I'm having the same problem. my value is 0x000000003DD56F2A type timestamp and I'm having trouble. I wrote code to share the solution, but it didn't work. What should I do.

thank you.

rproffitt commented: Start a new discussion if the above folk don't reply. +15

Or you could subtract the random number mod 3. That makes it easier to keep it within the given range.

x = new random number in range (-25,43)
x = x - x mod 3
matt21mcr commented: That looks great! I have no idea how to use it in my code, but I will be trying everything to work it out. I'd be so grateful if you could help me:) +0
JamesCherrill commented: Cunning! +15

Just had a thought...
if you get a random number and multiply it by 3 then you have a new random number that's divisible by 3.
Can it be that simple?

I'm not sure where should I put this loop inside the code of my program.

It effectively replaces line 12... instead of just getting one random value you keep getting new values until you get one that meets the criteria. I showed the pseudo-code as a function, but you can just put the loop in-line.
To keep things simple, just do the mod 3 bit for now, and worry about the no repeats later.

Plzzzzzz.... Help me
I need coding for scientific calculator consist of sin, cos, factorial, log, tan and division

rproffitt commented: "Do not hijack old topics with a new question" Community Rules. Start your new discussion now. -3

I want a Calculator on c++ contains sin, cos, factorial, log and division

rproffitt commented: "Do not hijack old topics with a new question" Community Rules. Also, 15 years late. +0
Reverend Jim commented: Lazy -3
JamesCherrill commented: and I want a Fender Stratocaster. Will you give me one for free? -3

As to not exit etc. menus and such that's basic logic. Example.

Something is true.
Do this while something is true.
Ask the user for input in "this" loop and if they want to exit, set something to false.

I think I have found an equation to work out a sine wave, but now I am stuck on the "Design a user interface allowing the user to specify the number of harmonic components to use. The user should also be able to re-run the calculation without exiting the program." part of the program.

Though I am not too sure if my sine wave equation is correct. For the most part it works and prints out the graph I need.

is it a better wau to modify the program I have already written, or modyfing the code mentioned above?

The second code doesn't do what you need, and you will have to try to understand it before you can mod it, and it's not your code (which is what your teacher expects). So in my opinion you should ignore it and carry on with your own code.

You're going to need an extra loop to keep trying new random numbers until you get one that is divisible by 3 and not present in the numbers you have already got...
in pseudocode...

int nextGoodRandom() {
     do
          get a random nunber
     until number %3==0 AND number is not in the existing numbers
     return number
}

not in the existing numbers can be determined by keeping a list of the numbers you have already used

matt21mcr commented: Thanks for your help. But since I'm a beginner I'm not sure where should I put this loop inside the code of my program... Thanks in advance. +0

Hello everyone,

I am writing this post again because there were ambiguities in the previous one. I need help with this task tomorrow. I will present what I have, what I got from you and ask which code is best to use to perform this task.

I will start with the program I wrote to fill the 6x6 array with random numbers and display it on the console. The program displays random numbers stored in an array in the range of -5 to 64 ... I believe deeply that it contains no error.

int x,y;  
    int rand_tab[6][6]; 
int main()
{

    srand(time(0)); 
    for(y=0;y<6y++)
    {

        for(x=0;x<6;x++) 
        {
            rand_tab[y][x]=(( rand() % 68 ) - 25 ); 
            cout << rand_tab[y][x] << " "; 
        }
    cout << endl;
    }

I know more or less what's going on, but I'm wondering how to modify the program to select numbers divisible by 3. How to add this code. I came up with such an idea:

    srand(time(0)); 

    for(y=0;y<6;y++) 
    {

        for(x=0;x<6;x++) 
        {
            if( (rand_tab[ y ]&& rand_tab[x]) % 3 == 0 )
             {

               rand_tab[y][x]=(( rand() % 68 ) - 25 );
            cout << rand_tab[y][x] << " ";

             }

Unfortunately, the program does not show me any values ​​in this case. Zong :-(

The next task that I need is to get started adding to the program a function that would display from the drawn numbers only those values that are not repeated from the rand () function.

I found a program on the net that does the rand () ...

You've got a lot of good code in there, but I think you have made it hard on yourself by trying to do it all in one big hit.
It's easier in the end to break it down into smaller steps and code AND TEST each one before moving on. Yes you will write some test code that is superflous to the end product, but you wil still get there faster. Right now you have to fire up a server and two clients just to test a simple counter in the game logic. That's slow.
Eg
I would start with the game itself as a stand alone unit. Public methods to start, make moves, declare winner etc. I would test that with a some hard-coded calls to the public methods and make sure its working. Shouldn't take long.
Then I would code the client with its GUI as a simple program and test it by having it call the game's public methods directly. Make sure it looks and works correctly.
Finally I would code, integrate, and test the server and client socket implementations.

It's an old but true cliché: "good programmers test early and test often".

The simplest architecture is to have the server do all the work and the clients just get user input to send to the server, and display whatever the server tells them to.

Ahh, so that's how it is. Honestly, it is a disaster.. been trying to debug this for a few days now. I was basically trying to make a turn based game where dealer puts the X on the GUI then the spotter "guesses" where it is. I have been having trouble thinking of a good win condition so I thought I'd just use count == 1 & hasWinner() to basically force the game like where the spotter picks a square and wins/loses.

Do you have any other suggestions I can try?