arinuchik
05.06.2021 12:17

Изучи параграф 8.2 в ЭУ https:/we.opiq.kz/kit/17/chapter/878

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
Выгуки
02.11.2022 06:15
#include <iostream>#include <stdlib.h>#include <locale.h>using namespace std;
void main(){ setlocale(0, ""); int a = 100, num, player = 1, correct; while (a > 0) { if (player == 1) { do { cout << "Ваш ход. На столе " << a <<" спичек" << endl; cout << "Сколько спичек вы берете?" << endl; cin >> num; if ((num > 0) && (num <= 10)) { correct = true; } } while (correct != true); } else { if ((a <= 10) && (a > 1)) { num = a - 1; } else if (a == 1) { num = 1; } else { if (num > a) { num = a; } } cout << "Компьютер взял " << num << " спичек" << endl; } a = a - num; if (player == 1) { player = 2; } else { player = 1; } } if (player == 1) { cout << "Вы проиграли" << endl; } else cout << "Вы победили" << endl; system("pause");}
0,0(0 оценок)
Ответ:
nonyshko
16.01.2022 09:32
1)
var   k,a,i,n : integer;
   t : Text;
    begin 
 readln (k);
 n := 0;
  Assign (t,'test.txt');
  Reset(t);
  i := 1;
   while not Eof(t) do
    begin   
 read (t,a);   
   if a = k then 
     n := i;   
   i := i +1;  
   end; 
  Close (t); 
 writeln (n);
 end.

2)

 var 
 t,t1,t2 : Text;
  i : integer;
  a : real;
 begin
  Assign (t,'text.txt'); 
 Reset (t);
  Assign (t1,'r1.txt');
  rewrite (t1); 
 Assign (t2,'r2.txt'); 
 rewrite (t2); 
   i := 1; 
   while not Eof(t)
 do  
 begin 
   read (t,a); 
    if i mod 2 = 1 then
      write (t1,a:3:3,' ') 
      else 
       write (t2,a:3:3,' ');
    i:= i +1;  
    end;  
  Close (t); 
 Close (t1); 
 Close (t2);
 end.
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота