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

127 thoughts on “Tasks and solution. С

  1. Display all three-digit positive integers, the sum of digits of which is equal to a predetermined number N.
    L=a*b*(b+c(which is a circle in the middle +)*a), and over it a great feature

  2. Please solve my this problem. 1084. Goat in the garden
    time Limit: 1.0 seconds
    memory Limit: 16 MB
    Let the goat in a square garden and tied to a peg. Peg stuck exactly in the center garden. goat hungry, like the wolf, prozhorliv, like a bull, and eats everything, to which dotyanet, not climbing over the fence and tearing rope. What is the area of ​​the garden will be gnawed?
    Initial data
    Side length backyard and the rope length in meters (positive integers, not exceeding 100, arranged in a single line through the gap).
    Result
    The area of ​​the garden (in square meters, up to 3 digits after the decimal point), delicious goat.
    Example
    input output
    10 6 95.091

    1. This problem is easily solved even analytically, on the basis of geometric relations planimetry (square, circle, range of sectors), and does not require this, even writing a program.

  3. Guys , Help,
    Run display the results of the function:
    P = (3 * m*m – (log(a – c))) / (pow(b, 3) + a);
    b = 0.75*a*a + pow(c, m);
    Then there is a system :
    a = ((log(t = d*d)) / (sqrt(pow(t, 2)*d), 3)); (in d>t, t>1)
    a = 2 * t*sin(d*d);(at t>1)
    a = pow(t, 3)*d;( in all other cases)
    The value is chosen from the set 0 5 increments 1,1; value selected from the set 0 3 increments 0,2; m=3. The value of the variable (with) sets the user with keyboard.
    int main()
    {

    double a, P, b, t, d, a, m = 3, c;
    cin << c;
    for (d = 0; d t && t > 1)
    {
    a = ((log(t = d*d)) / (sqrt(pow(t, 2)*d), 3));
    }
    if else (t > 1)
    {
    a = 2 * t*sin(d*d);
    }
    else
    {
    a = pow(t, 3)*d;
    }
    }

    }

  4. In the two-dimensional array (N+15)x(N+15) sort each column by decreasing doubles. Generate random numbers in the interval [-N-15; N+15].
    Solve sundry.

  5. help me please
    task J. Ретвинтим twinter
    Time limit: 1 second
    Memory limit: 512 megabyte
    project twinter (from the English word «the winter») - social network, in which you can write,
    How do you prepare for the coming winter. Each message in this network called tvint. Before
    tvinta length was limited 140 symbols, but recently, this limit has been increased to 280.
    If the user must write a long message, it is traditionally breaks it down into a series of
    several tvintov. In this case, at the end of each tvinta has its own number and the total number
    tvintov in the chain, for example:
    Winter!.. Peasant, triumphantly, (1/2)
    on wood-sledge update path. (2/2)
    The creators decided to twinter automatically reformat the old tvintov chain, taking into account
    New restrictions 280 characters. Help them to reformat this chain, after putting it in
    minimum number tvintov. Word - a sequence of characters, different from the sample-
    la - you can not split between tvintami. Characters at the end tvinta " (i/n)», given sequence
    tvinta number and the number in the chain tvintov, also included in the calculation of its length.
    The format of the input data
    The first line contains the integer n - number in the original chain tvintov
    (1 6 n 6 5000).
    Each of the next n rows contained tvint. It has a length of no more than 140 symbols and
    It ends with the line " (i/n)», where i - number of tvinta. Tvinty not begin with a space and
    It does not contain two spaces in a row. In tvintah can be only spaces, letters, digits
    and punctuation (with ASCII-codes of 33 to 63).
    The format of the output data
    In the first line output the number m - number tvintov built in your shortest tse-
    kidney.
    Then output tvinty chains one on line. They should not start with a space
    and comprise two consecutive gaps, end they have to " (i/m)», similar input
    data. The sequence of words in the original chain and deduced you must match.
    examples
    standard input
    2
    Winter!.. The peasant breathes a sigh, (1/2)
    renews his sledge, and makes his way. (2/2)
    standard out
    1
    Winter!.. The peasant breathes a sigh, renews his sledge, and makes his way. (1/1)
    standard input
    3
    An example with sylla- (1/3)
    bification and punctuation (2/3)
    ! (3/3)
    standard out
    1
    An example with sylla- bification and punctuation ! (1/1)

  6. Help task : The program takes the user to a three-digit integer. The program should inform, Whether it is the number of identical digits. If the entered number is not three-digit - Report an error
    how to make?

  7. people please help make a program in C ++ on a goto statement.
    here I branching process f ={cos(3x + y)-1 , x>y f={1+tan(and + 3) , x<= y
    -2<=x<=2 , шаг hx=0.2

Leave a Reply

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