Let us see who has the fastest programming skillz.
Write a program in c++ that prints (to the terminal) a reasonable approximation of the outline of the Swedish flag.
More props if you can get it to output in the correct colors as well.
>>57934859
I won't do your homework.
i won't draw anything about that cuckistan
>>57934859
>swedish flag
You mean dannebrog the danish flag, right?
>>57934926
Please..? It's part of my final exam and I DON'T have the skillz..
_____________
l.....|...............l
l-------------------l
l.....|...............l
There you go faggot. Put that in the print statement
>>57935009
>that font you must be using
I feel sorry anon
>>57934859
std::cout << "[+--]" << std::endl;
>>57934859
http://pastebin.com/e15mqS5N
Done
>>57935039
Comic sans :^)
>>57935048
"[-¦--]" *
>>57935098
PUT ME IN THE SCREENCAP
>>57935098
stealing this
>>57935127
/thread
>>57935098
Wow.
>>57935098
2017
>>57935198
y u no terminfo ?
>>57935238
What?
>>57935266
man tigetstr
>>57934859
source too long to post here
https://0x0.st/L6_.c
>>57935342
Do you have the faintest clue what you're talking about or are you just spouting names you barely understand? What retarded thing are you implying I should be doing? Do you want me to use curses for something as simple as this?
>>57935198
nice
>>57935198
>ccat
>c
what are these aliases?
>>57935098
oh my god
>>57935396
Using raw ANSI escape codes is not a very good practice. You should use the terminfo database, via the tigetstr() function for instance.
>>57935461
ccat is its own utility that works like cat but with syntax highlighting (colored cat)
c is a small script that compiles a C file and then runs the resulting binary if it compiles.
>>57935500
Thank you for actually using a sentence.
I wasn't exactly going for good practice in that tiny code snippet created in response to a shitpost.
>>57934992
>Please..? It's part of my final exam and I DON'T have the skillz..
this is really fucking easy you retard
you probably wouldn't even need to use curses or a similar lib for it.
>>57935534
>ccat is its own utility that works like cat but with syntax highlighting (colored cat)
>c is a small script that compiles a C file and then runs the resulting binary if it compiles.
I obviously saw the screenshot, I know what they do. In case it wasn't clear: I'm asking you for the source.
>>57935198
i like your terminal anon
>>57935560
https://github.com/jingweno/ccat
wow that took me like 3 whole seconds of googling
>>57935560
"ccat" Github is in the first Google results.
"c" shouldn't be very hard to mimic...
>>57935560
Yeah, sorry about that. I think I wanted to spread my knowledge and that was a dick move.
>>57935560
https://github.com/jingweno/ccat
https://github.com/ryanmjacobs/c
>>57935591
>>57935670
Thanks, seems I was expecting them to be something else. ‘ccat’ looked like it was an alias for something like pygments or whatever else that supports more languages than just C, rather than a dedicated program.
‘c’ looked like it was a neat little one-line alias/function or something I could copy/paste into my zshrc, rather than something I'd have to compile and package first. Oh well, at this point it's more effort than it's worth.
>>57935810
>‘c’ looked like it was a neat little one-line alias/function or something I could copy/paste into my zshrc
You could trivially write something like that and it would only be slightly less robust than the package
>>57935832
>You could trivially write something like that and it would only be slightly less robust than the package
I know, but see
>at this point it's more effort than it's worth.
It's not really about the utility, I just get excited copy/pasting neat zsh tricks from other people. Ever been to a “zsh tricks” or “vim tricks” thread? It makes me feel warm and fuzzy inside
I was hoping for that, but I did not get it. Oh well
>>57935555
if you cant do this simple task you dont deserve your grade
>>57935810
'c' is probably pretty simple. Something like this would work finec () {
tmp=$(mktemp)
cc -std=c99 $1 -o $tmp && $tmp
rm -f $tmp
}
You could improve it by having env variables change the compiler flags or output location
>>57934859
tjena bögjävel, gymnasienivå eller högre?
>>57935914
Hmm, maybe this could be improved so that it also works on STDIN instead of a filename
>>57935952
that would be an excellent feature.
but
>C REPL
every day we stray further from god's light
here's a cgi file#include <iostream>
using namespace std;
int main() {
cout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
cout << "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1600\" height=\"1000\" viewBox=\"0 0 16 10\">";
cout << "<rect width=\"16\" height=\"10\" fill=\"#006aa7\"/>";
cout << "<rect width=\"2\" height=\"10\" x=\"5\" fill=\"#fecc00\"/>";
cout << "<rect width=\"16\" height=\"2\" y=\"4\" fill=\"#fecc00\"/>";
cout <<"</svg>";
return 0;
}
>>57934859
Nah, fuck that shit.
>>57935670
That c thing is pretty cool. The ability to use a shebang and make a c "script" is actually pretty neat, hadn't thought about the possibility of doing that before.
>>57935098
What'd you use to generate that?
>>57936396
One more reason to do this:
>>57936304
I utterly hate homework fags. I hate how EVERY SINGLE TIME somebody is going to spoon feed them. I hate how some people will work until 4 AM to get a good solution and some idiots are just getting it for free.
Don't get me wrong, if people come here with a specific question I really like helping them. But this "homework white knighting" has to stop. It pisses me off so much.
>>57936466
I would much rather understand the process of how to go about writing the code anyways (especially how to produce the color) for future projects.
>>57934859
Shillz? We got more than enough of them. You can take some on your way back
>>57935900
honestly i wish the shit i was doing on my finals was this easy, this would literally take me a few seconds at most.
>>57934859
We're not doing your homework for you, Ahmed.
You should do your own homework like Erik and Gustav.
printf("[--|--]\n")
there you go, I hope the microsoft overlords approve your application pajeet
#include <iostream>
using namespace std;
int main()
{
for (int i = 0; i < 16; i++) {
for (int i = 0; i < 20; i++) {
cout << "\u2592";
}
for (int i = 0; i < 8; i++) {
cout << "\u2593";
}
for (int i = 0; i < 48; i++) {
cout << "\u2592";
}
cout << endl;
}
for (int i = 0; i < 8; i++) {
for (int i = 0; i < 76; i++) {
cout << "\u2593";
}
cout << endl;
}
for (int i = 0; i < 16; i++) {
for (int i = 0; i < 20; i++) {
cout << "\u2592";
}
for (int i = 0; i < 8; i++) {
cout << "\u2593";
}
for (int i = 0; i < 48; i++) {
cout << "\u2592";
}
cout << endl;
}
return 0;
}
Close enough
>>57935098
ayy lmao