M
M
Maxim Ivanov2015-10-14 00:00:00
C++ / C#
Maxim Ivanov, 2015-10-14 00:00:00

How to draw a simple graph or drawing in C++?

Well, really, I'm wondering, is it possible to somehow do without WinAPI and other difficulties? I wanted to show my schoolboy brother a simple drawing (plotting a graph y=x), but not only did I not find normal sources that would work for me, but it also turns out to be not a trivial task!
In the first year, we wrote in 25 lines of code in Assembler (albeit under DOS) and displayed the flag of Russia / France .. no problem, but why is there no such simple possibility in C ++ (only not under DOS)?
I inserted the code found on the Internet under Dev ++, the program did not compile, I inserted another similar code into Qt creator, it did not work either (lack of graphics.h), I installed visual studio 2013, I wonder if I can find a working code for it?
Tell me if there is documentation with good instructions, where you can draw graphs in C ++ in a procedural style (I just know the basics of it, I don’t have time to learn other languages ​​yet, and is it worth it ..) in the same Visual Studio 2013?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Antony, 2015-10-14
@omaxphp

No one on a modern OS will let you just draw wherever you like. This is all done through the system. On any PL, you will have to use the system tools directly (WinAPI or framebufer under *nix) or indirectly, through third-party libraries and frameworks.
Since you are using VS - well, draw with the help of MFC (or whatever more modern receiver it has, I'm a little off topic).
If you are for 1 time, then you can resort to necrophilia and take some Borland C ++ Builder 6. I used it in the 1st year - to draw a line on the form is 2 or 3 lines of code.
Take some current framework (Qt - if you need multiplatform, or MFC if you need only Windows) and read its documentation.
And atQt and VS have great documentation.

A
AtomKrieg, 2015-10-14
@AtomKrieg

Take game libraries for 2d toys: sfml, sdl, hge. There are millions of such libraries.

A
Alexander Taratin, 2015-10-14
@Taraflex

Draw a graph for your brother on a piece of paper or www.wolframalpha.com

K
Kirill Romanov, 2015-10-14
@Djaler

graphics.h - Borland Graphic Interface library. The port for visual studio can be found on the internet

E
Eugene, 2015-10-14
@jk_action

Alas, C++ can do little other than hello world out of the box. C++ is demanding on tool knowledge. And you still have to study them in order to solve your problem. I would recommend other means, but you do not have time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question