procedure TfrmMain.FindFilesOnDisk(Dir : string);
var SR : TSearchRec;
Err : integer;
i, j : integer;
st : string;
begin
if (Dir[Length(Dir)] <> '\') then Dir := Dir + '\';
Err := FindFirst(Dir + '*.*', faAnyFile, SR);
while Err = 0 do
begin
j := 0;
st := AnsiUpperCase(SR.Name);
if lbDirs.Items.Count > 0 then //Если в списке есть каталоги
//Проверить, нет ли среди них
for i := 0 to lbDirs.Items.Count - 1 do
if lbDirs.Items[i] = st then //найденного
begin
j := 1;
break;
end; //if lbDirs.Items[i] = st then
if j = 0 then
begin
if (SR.Name <> '.') and
(SR.Name <> '..') and
((SR.Attr and faDirectory) <> 0) then
begin
inc(NumDir);
DirList.Add(Dir + st);
frmMain.sbMain.Panels[1].Text := IntToStr(NumDir);
pbFind.Position := NumDir;
Application.ProcessMessages;
FindFilesOnDisk(Dir + SR.Name);
end; //if (SR.Name <> '.') and
end; //if j = 0 then
Err := FindNext(SR);
end;
end;
Объяснение:
#include <iostream>
using namespace std;
int main() {
// Variables
int number;
bool isPositive = false;
int numberCountDigits = 0;
// Input data
cout << "Input nubmer" << endl;
cin >> number;
// Create Solution
if (number > 999 || number < -999) {
cout << "Incorrect number" << endl;
return 0;
}
if (number >= 0) {
isPositive = true;
}
while (number != 0) {
numberCountDigits++;
number /= 10;
}
// Output Solution
cout << "-- Information --" << endl;
isPositive ? cout << "Is Positive number" << endl : cout << "Is Negative number" << endl;
cout << "Digits count: " << numberCountDigits << endl;
return 0;
}