Can you tell me what you need to write in a simple code so that after the function is executed it returns to the beginning?
That is, roughly speaking, started up again.

Code:

#include <stdio.h> #include <iostream> #include <locale.h> #include <conio.h> using namespace std; int main () { setlocale (0, ""); int x = 0; int y = 0; int z = 0; cout << "Введите числа х, y" << endl; cin >> x; cin >> y; z = x + y; cout <<"z = "<< z << endl; _getch(); return 1; } 
  • 3
    heard about the cycles? - DreamChild
  • In fact, I just don’t understand how to use it in this case .. Since the loop is executed before accepting a value = not infinite. That is, if I understand correctly after a certain random number dropout, sooner or later one of the variables will coincide with the value of the variable until which the cycle will cycle (after which it ends (if I understood correctly)). Roughly speaking, the return to the beginning of the code is interesting .... a sort of return2begin) - seawed
  • @seawed: did you hear the while ? Read, you will surely enjoy. - VladD
  • I did not quite understand your explanation .. but I will pretend that I did understand. Probably you want something like that? char p; while (p! = 'q') {cin >> p; cout << "\" "<< p <<" \ "wasp pressed" << endl; } - DreamChild
  • one
    @seawed: You still hold the book. Because: * In C ++, the equality test is denoted as == , and not = (a = means assignment). * If you have set ; after while , thus you declare the loop body empty - remove the semicolon. * conditions in while do not necessarily check a numeric variable, there can be any condition, any expression of type bool . In particular, the constant. - VladD

0