mayerok
17.10.2020 23:11

Linux
a. run command cd; mkdir -p test/{test1,test2,test3}/{abc,def,ghi}; touch test/test{1,2,3}/abc{1,3,5,7}{a,b,c,d,e,f}.txt; touch test/test{1,2,3}/{abc,def}/testfile; cd -
b. output (using echo and wildcards) names of files in all 3 dirs (test1, test2 & test3) with any digit in their names with the final letter before extension (.txt) being "f".
c. output all files with .txt extension in directory test1.
d. output everything in test1 directory.
note: in all output commands use single symbol substitution for representing single symbol and multi-substitute symbol in opposite case. make sure commands will work no matter in which place in filesystem they are run

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
shansosia05sofisofi
19.08.2021 09:34
1)
#include <iostream>
#include <math.h>

using namespace std;

int main() {
 int a;
 cin >> a;
 int d = a%10;
 string s = "yes";
 while(abs(a) > 0) {
   if(a%10 != d) {
     s = "no";
     break;
   }
   a/=10;
  }
  cout << s << endl;
}
2)
#include <iostream>
#include <math.h>

using namespace std;

int main() {
 int a;
 cin >> a;
 int d = a%10;
 a/=10;
 string s = "no";
 while(abs(a) > 0) {
  if(a%10 == d) {
    s = "yes";
    break;
  }
  d = a%10;
  a/=10;
  }
  cout << s << endl;
}
0,0(0 оценок)
Ответ:
Dzhyzefina
19.08.2021 09:34
PascalABC.NET 3.4.2, сборка 1864 от 11.11.2018Внимание! Если программа не работает, обновите версию!

begin

 var n := Abs(ReadInteger('Введите целое число:'));

 var yes := False;

 var n1 := n mod 10;

 n := n div 10;

 while n > 0 do

 begin

   var n2 := n mod 10;

   if n1 = n2 then

   begin

     yes := True;

     break

   end;

   n := n div 10;

   n1 := n2

 end;

 if yes then Print('Верно')

 else Print('Неверно')

end.


А еще это можно решить, к примеру, так:

begin

 var s := Abs(ReadInteger('Введите целое число:')).ToString;

 if s.Pairwise.Any(t->t[0]=t[1]) then Print('Верно')

 else Print('Неверно')

end.

0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота