A
A
anonymous53822014-07-16 19:44:33
Character encoding
anonymous5382, 2014-07-16 19:44:33

What bike to write in C++ to consolidate what you have learned?

Good day to all. Studied (if I may say so) basic, composite data types, loops, logical operators, branch operators, functions, pointers, references, namespaces, OOP (classes, inheritance, abstraction, polymorphism, encapsulation), exceptions, templates, file input and conclusion, some STL. Throw up an idea for some not very complex project that you can try to write with such knowledge.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
H
Heyzi, 2016-04-05
@rudimo

This is the image itself, you can translate from this format, for example, here: freeonlinetools24.com/base64-image
As a result:
bRfA

T
tsarevfs, 2014-07-16
@tsarevfs

A tricky but I think useful task:
Write a TCP server using sockets and the poll(select for windows) system call. An example interface is shown below. It's probably more convenient to write under linux, although it shouldn't make much of a difference. Multiple client connections must be supported (you can use the netcat utility as a client). If you take it, I can give hints along the way.

typedef std::function<void(std::String const &, std::String const &, int)> on_msg_func_t;

Class TcpStringServer
{
public:
  void register_on_msg_func(on_msg_func_t const & func);
  void start(int port);
  void send_msg(std::string const &addr, int port, std::string const &msg);
};

void on_msg_func(TcpStringServer const & server, std::string const &msg, std::string const &addr, int port)
{
  server.send_msg("OK");
  std::cout << (boost::format("message %s resivied from %s:%d") % msg % addr % port ).str();
        //std::cout << "message " << msg << "received from " << addr << ":" << port << "\n";

}

int main()
{
  TcpStringServer server;
  server.register_on_msg_func(std::bind(on_msg_func, server, _1, _2, _3));
  server.start(12345);
}

Possible development:
* simple network game, tic-tac-toe to start
* remote console (ssh prototype)

A
Alexey Pavlov, 2014-07-17
@lexxpavlov

Make some simple game, with a minimum of actions, but with the use of all your arsenal with c ++, especially OOP.
For example, write a rogue-like game like the one described in this thread .
Here you will have to work with graphics, and store data in files with configs (items, monsters, levels), and game mechanics (movement, hits), and artificial intelligence (path search).
Graphics can be made both console (in text mode), and master some kind of graphic library (Qt, for example). And you can write two different interfaces and choose whether to run in the console or in a window.
Later it will be possible to add networking and a game mode for two.
This project is (relatively) easy, but will give you a lot of hands-on experience. After all, it’s one thing to write classes for educational purposes, when the final hierarchy is known in advance, and another thing is to fully develop the hierarchy, implement it, see what didn’t work out very well (it often happens, you need experience), find a way to refactor, discover the value of interfaces , rewrite classes to use interfaces (or common abstract ancestors), see that it's much better, be happy for yourself, let your friends play, get bug reports, fix all bugs, and so on.

A
Alexander Taratin, 2014-07-16
@Taraflex

rss parser

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question