При сохранении и копиравании файлов на другой компьютер возможно что файлы не будут открываться? что нужно сделать чтобы этого не произошло? что нужно учитывать при сохранении файлов
1) var f:text; a:array[1..7] of real; i,k,c,x:integer; s:string; begin for i:=1 to 7 do begin readln(x); a[i]:=x; end; assign(f,'file.txt'); rewrite(f); for i:=1 to 7 do begin str(a[i],s); writeln(f,s); end; close(f); reset(f); k:=0; while not eof(f) do begin readln(f,s); val(s,x,c); if x<0 then k:=k+1; end; close(f); if k<>0 then writeln('В массиве ',k,' отрицательных элемента(ов)'); else writeln('В массиве нет отрицательных элементов'); erase(f); end.
2) Var a,b,c,d:integer;
Function max(a,b:integer):integer; begin if a>b then max:=a else max:=b; end;
Begin readln(a,b,c,d); a:=(max(a,b)); b:=(max(c,d)); writeln('max=',max(a,b)); End.
Using System; namespace Fractions{ public struct Fraction : IComparable<Fraction> { public Fraction(int numerator, int denominator) { Numerator = numerator; Denominator = denominator; } public int Numerator; public int Denominator; public int CompareTo(Fraction other) { return (Numerator * other.Denominator).CompareTo(other.Numerator * Denominator); } } public class Program { static void Main(string[] args) { int numerator, denominator; Console.Write("Числитель первой дроби "); numerator = int.Parse(Console.ReadLine()); Console.Write("Знаменатель первой дроби "); denominator = int.Parse(Console.ReadLine()); var fraction1 = new Fraction(numerator, denominator); Console.Write("Числитель второй дроби "); numerator = int.Parse(Console.ReadLine()); Console.Write("Знаменатель второй дроби "); denominator = int.Parse(Console.ReadLine()); var fraction2 = new Fraction(numerator, denominator); var compareResult = fraction1.CompareTo(fraction2); if (compareResult < 0) Console.WriteLine("<"); else if (compareResult > 0) Console.WriteLine(">"); else // = 0 Console.WriteLine("="); } }}