#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,d1,d2,d=0,n=0;
srand (time(NULL));
a = rand() % 50 + 1;
b = rand() % 50 + 1;
c = rand() % 20 + 1;
while (c>a) a = rand() % 50 + 1;
while (c>b) b = rand() % 50 + 1;
printf ("%d %d %d\n", a, b, c);
d1 = a; d2 = b;
while (d1>=c){
d2 = b;
while (d2>=c){ n++; d2 -= c; }
d1 -= c;
}
printf("%d\n", n);
for (int i=0; i<(10-1); i++) d += n;
d = -d;
printf("%d", d);
return 0;
}
Пример:
<span>27 42 4
60
-540</span>
<h3>PascalABC.NET 3.4.2, сборка 1814 от 02.10.2018</h3>
begin
ReadInteger('n->').ToString.JoinIntoString(' ').ToIntegers
.Where(t -> t mod 4 = 0).Sum.Println;
end.
<span>алг квадратное уравнение
нач
вещ a, b, c, D, x1, x2
ввод a
ввод b
ввод c
D := b**2 - 4*a*c
вывод "D = ", D, нс
если D > 0 то
x1 := (-b + sqrt(D)) / (2 * a)
x2 := (-b - sqrt(D)) / (2 * a)
вывод "x1 = ", x1, нс
вывод "x2 = ", x2, нс
иначе
если D = 0 то
x1 := -b / (2 * a)
вывод "x = ", x1, нс
иначе
вывод "корней нет", нс
все
все
кон</span>
Комменты в коде По пунктам:
C++Выделить код
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 #include <iostream> #include <stdio.h> #include <string> #include <fstream> #include <Windows.h> int main() { std::fstream myfile; std::string parse_string,word; std::string::size_type beg_idx = 0, end_idx = 0; const std::string delim_string (" "); int howManyStrings = 0; bool onlyTwo = true; myfile.open("file.txt",std::ifstream::in); while(!myfile.eof()) { beg_idx = 0, end_idx = 0; getline(myfile,parse_string); //Ваш 2й пункт. howManyStrings++; //Ваш 1й пункт. 11 11 22 55 33 66 88 44 99 111 222 5555 8888 77 99