I'm supposed to do this programming test for a job interview. I'm fine with C++, but this quiz is clear as mud. Am I supposed to use a library? Do they want something to appear on screen?
I guess I'll email them and ask, but holy shit fuck this company already.
>giving the company free source code
sorry but they won't be calling you back
>>57364915
You're probably not supposed to use a library.
As for what kind of output they want, I have no clue, but they do specify mm, so maybe they want you to actually be printing these fucking things? Or maybe they use the measurement to just give you a ratio?
Regardless, fucking ask them.
If you actually got a job there they'd probably want you to ask questions rather than just fuck their shit up.
>>57365001
Not even a graphics library?
>>57365016
Depends on what kind of output they want, as I said, just fucking ask them.
>>57364915
dis thread demeans us both#include <stdio.h>
int grate_width = 12;
int grates = 22;
int height = 100;
void print(char *s, int n)
{
while (n--)
puts(s);
}
void putgrates(char *gratecol, int n, int width)
{
int i;
for (i = 0; i < n; i++) {
printf("0 0 0\n");
print(gratecol, width-2);
printf("0 0 0\n");
if (i < n-1)
print("255 255 255\n", width);
}
}
int main(void)
{
printf("P3\n%d %d\n255\n", grate_width*grates + grate_width*(grates-1), height);
putgrates("0 0 0\n", grates, grate_width);
while (--height > 1)
putgrates("65 113 156\n", grates, grate_width);
putgrates("0 0 0\n", grates, grate_width);
return 0;
}
>>57364915
they are probably asking you to generate PostScript file from scratch
>>57364944
they have explicitly say said that "We draw grating pattern on the eraser" so it implies they don't need it.
I mean fuck programmers are really spoiled.
Regardless OP, could you tell the name of the company?
You can do it in matlab very quickly I think. Just make a sin image and go.
Assuming 1px = 1mm.main = let dim@[width, height] = [100, 100]
header = unlines ["P3", unwords $ map show dim, "255"]
line = unwords $ take width $ cycle ["0 0 0", "255 255 255"]
in mapM_ putStrLn $ header : (replicate height line)
>>57367343
>haskell