The basics of programming in c++ for beginners

Tasks and solution. С

  1. Data types, variables and constants
  2. Ввод с клавиатуры и вывод данных на экран
  3. Арифметические операции и комбинированные операторы
  4. Операторы выбора if и else в С
  5. The switch statement in C ++
  6. The for loop in C++
  7. Циклы while, do while, nested loops
  8. Two-dimensional arrays C ++
  9. Arrays in C++
  10. Functions in C++
  11. Pointers C ++
  12. A pointer to a pointer to C ++
  13. Classes in C ++

Additional collection of problems with solutions

практика программирования, задачи с решением, задачи по программированию с++, задачи по программированию C++

This page contains all of the tasks on the topics lessons, posted on our website. К каждой задаче прилагается наш вариант решения. Постарайтесь всё же решать их самостоятельно и только потом сравнивать наш исходный код со своим. “Хочешь научиться программировать – программируй”!

Больше практических заданий с решениями найдёте here.

Рекомендуем посетить Сайт для юных программистов – где вы найдете уроки по различным языкам программирования (в том числе для детей), 3D-моделированию, Linux и др.

128 thoughts on “Tasks and solution. С

  1. Help do the job
    It is given to the user 2 attempts to execute. He enters a string. If in
    line present symbol *, then the user enters another line, and if not
    - then two more lines. Demonstrate the performance of all 8 functions from the table
    on these lines.

    1. #include
      #include
      #include
      using namespace std;
      int main()
      {
      float x, Y;
      cout <> x;
      y = (pow(x, 2) / (x + 2) + without(x) + 1);
      cout << "y=" << Y << endl;
      return 0;
      }

  2. Create a program HIT2, which:
    0. “Is thinking” circle O centered at the point (x0,y0)
    and radius R.
    1. Enters real coordinates from the keyboard (x,Y)
    point A on the plane.
    2. Checks, does point A fall inside (either to the border)
    circle O.
    3. Until, until the point gets inside,
    displays a message
    “Warmer” or “Colder” whichever, closer or
    a new point is farther from the center of the circle than
    from the previous,
    and repeats points 1, 2, 3.
    4. Displays the result on the screen as:
    “Point (x,Y) fell into a circle centered at the point (x0,y0)
    radius R”,
    substituting into the result instead of R, x0,y0, x,y their values.

  3. Write a C program ++ for
    being at, if given x is entered from the keyboard.
    у = x ^ 2,
    x+sinx,
    lnx,
    if 3 less x less 5
    if x is less than or equal 0
    in other cases

  4. In a C ++ program, it is necessary to tabulate the function y on a given segment, then write in a one-dimensional array M the difference between the left and right adjacent values ​​of this function, and in a one-dimensional array N - values ​​X, at which the function takes negative values.
    y = lg(4x+10)cos2x [0, 4] , h = 0.4.
    Next, find the maximum element in the array M and N, and swap them.
    Form matrix K, dimension equal to the minimum of the dimensions of one-dimensional arrays M and N, and the values ​​of the elements K[I][J] equal to the largest of M[I] and N[J]. In the resulting two-dimensional array K, find the product of the elements of the main diagonal and the arithmetic mean of the entire array K.
    Then print all the values ​​of the original function on the segment in the form of a table “Y”, arrays M, N before and after changes as header lines, matrix K before and after the change, all the results you are looking for.

  5. There is a sequence of points on the coordinate plane, given
    using two arrays, one of which contains values
    coordinates of points along the axis OX, in the other, the values ​​of coordinates along the axis ОY.
    To find out, how many points are outside the first quadrant.
    Help urgently solve

Leave a Reply

Your email address will not be published. Required fields are marked *