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 и др.

132 thoughts on “Tasks and solution. С

  1. Write a program in C ++, to calculate the values ​​of the variables y and z according to the given formulas. Use scanf function for input, for withdrawal- printf function. Determine the difference in values ​​between y and z (y-z).
    y = cos(a)+without(a)/cos(a)-without(a)
    z = tan(2a)+sec(2a)

    1. #include
      #include
      #define PI 3.14159265

      int main()
      {
      //char str[80];
      define PI, from, Y, b;

      printf (“define PI “);
      scanf_s(“%f”, &a);
      define PI(a * PI / 180.0)+without(a * PI / 180)/ cos(a * PI / 180.0)- without(a * PI / 180);
      define PI(2 * a * PI / 180.0) + 1 / cos(2 * a * PI / 180.0);
      define PI – from;
      define PI(” %[object Window]”, Y, from, b);

      }

      1. help me please!!
        Triangle class
        properties: Triangle class
        Triangle class:
        Triangle class (Triangle class) Triangle class;
        About calculating the length of the bisector belonging to any angle;
        About calculating the length of the bisector belonging to any angle, About calculating the length of the bisector belonging to any angle;
        About calculating the length of the bisector belonging to any angle.

  2. Write a program in C ++
    An array of real numbers is specified. Determine the number of the largest element of this array and delete it, moving all the elements to the left by one position, located at the maximum. Print an abbreviated array.

    1. #include
      using namespace std;
      int main () {
      int i,j,n,a[1000],b[1000];
      int maxim=0,z=0,num=1;

      cout <> n;
      cout << endl;

      for (i=0; i<n; i ) {
      cout << on one <> a[i];
      num++;
      }

      while (from!=i) {
      maxim=0;
      for (j=0; jmaximum)
      maxim=a[j];
      }
      for (j=0; j<i; j ) {
      if (a[j]==maxim)
      a[j]=0;
      }
      b[from]=maxim; with ++;
      }

      cout << endl;
      for (j=0; j<from; j ) {
      cout << " " << b[j];
      }
      return 0;
      }

  3. Write a program in C ++
    Enter an array of real numbers from the keyboard (maximum dimension - 25 elements). Enter the numbers of those elements entered in the new integer array, which exceed the average value of all its elements by two or more times. Print the generated array or display a message about the absence of such elements.

    1. #include
      using namespace std;

      int main() {
      system(“chcp 65001”);
      int arr1[25], arr2[25];
      cout <> x;
      cout << "Input numbers array" << endl;
      for (int i = 0; i > arr1[i];
      average += arr1[i];
      }
      average /= x;
      int j = 0, checkNumbers = 0, average1 = average * 2;
      for (int i = 0; i < x; i ) {
      if (average1 < arr1[i]) {
      arr2[j] = arr1[i];
      j ;
      checkNumbers++;
      }
      }
      if (checkNumbers == 0) {
      cout << "These elements no found";
      }
      else {
      cout << "Out array = ";
      for (int i = 0; i < j; i ) {
      cout << arr2[i] << " ";
      }
      }

      return 0;
      }

  4. help me please, very urgently needed
    In the two-dimensional array (N+15)x(N+15) sort each pair
    descending column. Generate random numbers in the interval [-N-15;
    N+15].

  5. given an array of real numbers of dimension n. If the array is ordered in ascending or non-increasing order to leave it unchanged. 4 keeping the order of the other members. I will be grateful

  6. given an array of real numbers of dimension n. If the array is ordered in ascending or non-increasing order to leave it unchanged. 4 maintaining the order of the other members. I will be grateful for C ++

  7. Identify, in which half of the array is the maximum element of the array,
    provided that he is the only one.

  8. Describe the functions of keyboard entry of elements of a one-dimensional mass-
    Describe the functions of keyboard entry of elements of a one-dimensional mass 2
    elements: Describe the functions of keyboard entry of elements of a one-dimensional mass 0, Describe the functions of keyboard entry of elements of a one-dimensional mass
    Describe the functions of keyboard entry of elements of a one-dimensional mass.

Leave a Reply

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