Hack Forums
[C] [C] Block diagram to C code [[Simple]] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] [C] Block diagram to C code [[Simple]] (/showthread.php?tid=5125940)



[C] Block diagram to C code [[Simple]] - crossera - Jan 8, 2016

1:[Image: Es3fEo1qODPtcPxl_r7tWOmBGUcI2yJT3n_vD_CF...w1332-h513]

2:[Image: uE39lrwut76SCBCNUfp8HhAQD6UhJiQUF7X2wPa1...w1332-h513]

3:[Image: Edrh-2TWwi6Nnz9Uinnr6qrKsqMlCP1ngU_AX2lO...w1332-h513]

4:[Image: dTOMzigOkRvIpie7gTQAlfuyQxb0BZzdDnMk0TY5...w1332-h513]

Need all 4 done and translated to c language.
I'm also willing to pay for it


* - exploit.c - Jan 8, 2016

Mind fixing the last two images?


* - crossera - Jan 8, 2016

(Jan 8, 2016 07:45 AM)exploit.c Wrote:  Mind fixing the last two images?

what's wrong with them? they appear completely fine for me?
Here is imgur link of all 4 images: https://imgur.com/a/7hBLz

Thank you for helping me!


* - exploit.c - Jan 8, 2016

(Jan 8, 2016 07:48 AM)crossera Wrote:  what's wrong with them? they appear completely fine for me?
Here is imgur link of all 4 images: https://imgur.com/a/7hBLz

Thank you for helping me!

They're broken for me here, thanks for album link.


* - crossera - Jan 8, 2016

(Jan 8, 2016 07:58 AM)exploit.c Wrote:  They're broken for me here, thanks for album link.

I'm the thankful one here, really appreciate it.


* - Goodies - Jan 8, 2016

Posting to lurk and wait for answers. I have no idea.


* - crossera - Jan 8, 2016

(Jan 8, 2016 10:10 AM)Goodies Wrote:  Posting to lurk and wait for answers. I have no idea.

Damn.. Still waiting for answer.
Would appreciate it a lot


* - 0xDEAD10CC - Jan 8, 2016

My best interpretation of the last one (#4) would be:
Code
do
{
  w = q;
  a -= q1;
  while (a < b)
  {
    if (x[a] > q3) break;
    x[a] -= q4;
    a++;
  }
  z[w] = w;
  w++;
} while (w < p);

And #3:
Code
m = y;
do
{
  switch (a + w)
  {
    case 3:
      m += a;
    case 2:
      m += c;
    case 14:
      m += d;
      break;
    default:
      k = 17;
    case 7:
      m += b;
  }

  g[m] = m % i;
  m++;
} while (m < b);

No idea what the heck 'gp.αmoũH.' was supposed to be but I couldn't translated it so I interpreted as the default case.

There are some lines that look like VAR1 - VAR2, which makes absolutely no sense because it is a redundant expression that doesn't change anything. I interpreted those as subtracting VAR2 from VAR1.

I won't do anything more until I see that I'm on the right track.

Also, would the girl with the nailpolish hold her paper up like the rest of the photographed paper's because it isn't exactly easy to read from that angle. I also don't read Russian (looks like it's that language anyways). I interpreted 'ga' as 'if true' and the other gibberish that isn't 'ga' as 'if false' btw.

edit: Google translate just gives me 'hectare' when I input 'ga' for Russian ..
edit2: But it gives me 'not' for 'he' from Russian to English, so I'm willing to say my guess was correct.

None of these are necessarily difficult, it's just the fact that I don't understand Russian.


* - crossera - Jan 9, 2016

(Jan 8, 2016 07:28 PM)0xDEAD10CC Wrote:  My best interpretation of the last one (#4) would be:
Code
do
{
  w = q;
  a -= q1;
  while (a < b)
  {
    if (x[a] > q3) break;
    x[a] -= q4;
    a++;
  }
  z[w] = w;
  w++;
} while (w < p);

And #3:
Code
m = y;
do
{
  switch (a + w)
  {
    case 3:
      m += a;
    case 2:
      m += c;
    case 14:
      m += d;
      break;
    default:
      k = 17;
    case 7:
      m += b;
  }

  g[m] = m % i;
  m++;
} while (m < b);

No idea what the heck 'gp.αmoũH.' was supposed to be but I couldn't translated it so I interpreted as the default case.

There are some lines that look like VAR1 - VAR2, which makes absolutely no sense because it is a redundant expression that doesn't change anything. I interpreted those as subtracting VAR2 from VAR1.

I won't do anything more until I see that I'm on the right track.

Also, would the girl with the nailpolish hold her paper up like the rest of the photographed paper's because it isn't exactly easy to read from that angle. I also don't read Russian (looks like it's that language anyways). I interpreted 'ga' as 'if true' and the other gibberish that isn't 'ga' as 'if false' btw.

edit: Google translate just gives me 'hectare' when I input 'ga' for Russian ..
edit2: But it gives me 'not' for 'he' from Russian to English, so I'm willing to say my guess was correct.

None of these are necessarily difficult, it's just the fact that I don't understand Russian.

Bulgarian actually.. Quite similar.
Thank you for the help, it was enough.
Or at least I hope, we will understand soon.
Thank you once again, I really appreciate it.


* - 0xDEAD10CC - Jan 9, 2016

You just need to follow the lines. Any circular paths are either going to be a do-while, for, or while loop. If the line branches off to some code after the circular flow of code depending on the first condition, then you know it is a while loop because the condition is evaluated before the while loop body is executed. The ones I did did not have that structure and ended up being do-while loops. There's multiple ways to write code, but I tried to keep it in the most clear form. If you need further help just let me know.

A good strategy I found is to start from the top, put braces around each section, and add in whatever was missing from the diagram. Lastly, re-read it to make sure that it follows the pattern described by the flow chart in the diagram.