c++

"int main(int argc, char *argv[]){}" - how does it work?

Why is this necessary? What's it? I am learning from the book " Krupnik A. tutorial C++. Peter2005 " there is such a program ... } infile.close(); } Here is the question, what does this program actually do, and why do these variables argc and argv?

For what in main (int argc, char *argv[])

I recently started learning C++ and don't understand why to take 2 arguments? One is an integer, and the second is an array, and the memory is allocated in a strange way without new. Where do these arguments come from and why are they used?

Include in header files

I noticed that in different C++ projects, programmers use the #include{[3 directive differently]} 1) In the first case, incl ... line-up styles? How to do it right, and how to do it wrong? I want to study this topic from the beginning. Where to start?

Command to press the play/pause button in the player

Now many players (Windows Media, PowerDVD, etc.) use the universal play/pause button. Tell me, is there a universal way to send the command to press this button in the application window?

How can I call another constructor from one constructor in C++?

How can I call another constructor from one constructor in C++?

C++project linking error

I wrote a program to translate numbers from DEC to HEX and vice versa with different functions on Windows using MVS, now it's ... rong command" << endl; cout << endl; break; } } while (n != CMD_EXIT); return 0; }

What is the difference between 'short int' and 'int16 t'?

I watched a course on C++ on Coursera and they told me that you can connect the cstdlib library and use data types like: int1 ... as how to write just short int, long int, etc. The question is, is there a difference between them, or is it the same thing?

How to use kbhit () and getch () in C++ on Linux

I'm writing a small "snake" in C++ on this to the tutorial. Faced with such a problem that I need to use kbhit() and getch() ... k; } } int main() { setup(); while(!GameOver) { draw(); input(); logic(); } }

A difficult task in C++. Topic: sorting a matrix (two-dimensional array)

Given a one-dimensional array of numbers, its values must be passed to a square matrix, but so that the numbers are not repea ... олнить программу еще раз? (1-да, 2-нет)\n"; cin>>menu; if(menu!=1)break; } return 0; }

Write a function that takes any number and returns the sum of the first and last number

Greetings to all. There is such a task: you need to write a function that takes any integer number as input, and returns the ... = 10; } int First = Number % 10; int Last = Number % 10 + Number; return First + Last; }

Java socket: connection hangs

I write code in Java, I will attach the code below, there are also comments in places where the connection hangs. According t ... fwrite(buf,1,sizeof(buf),F2); } fclose(F2); } int main() { new_server(); }

How do I change the system language in windows programmatically?

Windows server 2008 rc2 system Calls setlocale(LC_ALL,"Rus"); setlocale( LC_ALL, "ru_RU.CP1251" ); std::system("chcp 1251"); ... etACP () returns 1251. Is it possible to do this? Is it possible to do this without connecting non-standard ones libraries?

Using Denwer to work with a database in C++

Good time of day. Please tell me how to understand the process of linking a C++ application with Denwer. I used to use Denw ... calhost' (10061)"). I'm thinking, maybe there is a missing application that would help in linking my application with Denwer?

how to free up memory with free()

The class creates a structure and a pointer to it. In the constructor, the necessary memory is allocated for the structure. A ... the structure. How do I do this correctly using the free () function ? if (pData) free(pData->matrix); // это не работает

How to represent a four-dimensional array?

Two-dimensional array: Int mas[2][3] = { {1,2,3}, {1,2,3}, } I.e. 3 values and 2 strings. Three-dimensional array: I ... e. the same as a two-dimensional array only 4 dimensions. And how to present and write in this format 4 a dimensional array?

Dynamic memory allocation and smart pointers

How can I allocate memory for an array using shared_ptr? I tried to do something like this, but it crashes when executed. # ... ; ++i) array[i] = i; for (unsigned int i = 0; i < size; ++i) cout << array[i] << " "; return 0; }

Overloading the C++assignment operator

I can't figure out how to overload the assignment operator. With binary operators, more or less everything is clear, there ar ... to the assigned number, or something like that, and show to what and from what it is assigned and to what it is added where.

Multiple - defined character detected-one or more

I have a code. Class, implementation, and main function. When everything is in a single cpp file, everything works. I tried t ... (?kool@@3MA) уже определен в machine.obj 2) Oшибка LNK1169 обнаружен многократно определенный символ - один или более ПР 6

C++ Problem with std::cin std::cout

I have a problem, the code is calmly compiled into the exe, and the first two inputs work perfectly, but when it comes time f ... ns, please ask. [23.03.2020 19:22] Corrected: Changed the names of the variables, for greater simplicity and understanding.

Overloading a string class

Forumchane, please help with the task. I do not understand how to overload some of the operators. Here is the problem conditi ... ; return 0;} } } I don't understand how to overload the other operators.... Please help me, I will be very grateful.