The best ride question is answered in Pascal language

Updated on technology 2024-04-01
10 answers
  1. Anonymous users2024-02-07

    1.Read in two data, A and B, and output them one by one. The first a b should refer to the divisibility of a b, and then the decimal division is the division with decimals, that is, the ordinary division.

    Procedure vara, b: integer;

    beginreadln(a,b);

    writeln(a,'+',b,'=',a+b);

    writeln(a,'-',b,'=',a-b);

    writeln(a,'*',b,'=',a*b);

    writeln(a,'/',b,'=',a div b);

    writeln(a,'/',b,'=',a/b:2:2);

    writeln(a,'/',b,'=',a div b,'...',a mod b);

    readln;

    end.2.First, read this character, use the pred() function to find the precursor character, use the succ() function to find the subsequent characters, and then compare their ASQII code values, and output them from large to small.

    Procedure: var

    a:char;

    beginreadln(a);

    write(pred(a),' ',a,' ',succ(a));

    readln;

  2. Anonymous users2024-02-06

    For example, a is equal to 10, b is equal to 5, and the result of a + b is 10 + 5 = 15

    vara,b,s:real;

    beginread(a,b);

    s:=a+b;

    write("a+b=",s);end

  3. Anonymous users2024-02-05

    In order, the first one is satisfied, and then the next one will not be executed, so it is only executed.

    You take care to understand what else means"Otherwise"

    Since they are"Otherwise"Therefore, the previous conditions must not be met, so the content of Otherwise, it is necessary to execute the content.

    It's just that otherwise it's just another if statement.

  4. Anonymous users2024-02-04

    If you find the first one that matches, execute the then following statement, and then skip to the next semicolon to continue.

  5. Anonymous users2024-02-03

    (Master, hehe) only executes one statement. Keep in mind that this if set of else statements will always only be executed once. Since the first one is satisfied, then only execute".

  6. Anonymous users2024-02-02

    vara,i,n,k:longint;

    beginread(n);

    a:=1;i:=1;

    repeat

    inc(i);

    a:=a*2;

    k:=k+a;

    until i=n;

    writeln(k);

    end.Any questions you can ask me.

  7. Anonymous users2024-02-01

    The method downstairs is good, but can you really understand it?

    Let me explain:

    1.First of all, put 1 grain of wheat in the first grid, 1 >> 1

    In the second compartment put 2 grains of wheat, 2 >> 2

    In the third compartment put 4 grains of wheat, 3 >> 4

    Put 2 (n-1) grains of wheat in the nth lot.

    Can this be done?

    2.The next thing we need to do is to calculate how to design the algorithm output 2 (n-1) for the input n. The first thing that comes to mind is this:

    var i,n,s:longint;

    beginreadln(n);

    s:=1;for i:=1 to n-1 do

    s:=s*2;

    writeln(s);

    end.But! Longint can only store the number of -2147483648 to 2147483647 (i.e. -2 31 to 2 31-1), and the maximum calculation is 2 30, which does not meet the conditions of the problem, we say with high precision, which is a solution.

    For the storage scope of various data types in Pascal, see:

    Please look at the ** of the one downstairs, it is very short, but it is actually very efficient, and it is suitable for this question. Why?

    ta uses qword type, paraphrase on encyclopedia:

  8. Anonymous users2024-01-31

    Let's start with the idea.

    Look for it from the beginning of the string.

    3: Repeat 1 and 2, compare the length of the substring to get the new maximum length value, and modify the content of the source base and the longest substring of the starting value.

    The specific implementation of the program will be given later.

  9. Anonymous users2024-01-30

    I don't know if lz knows that bit operations are not. If you don't know, just search the encyclopedia.

    For example, the binary of 6 is 110, and the right two digits are 1, that is, 6 shr 2=1, a[n+1]:=maxlongint>>2; That's what it means.

    a[n+1]:=maxlongint shr 2;Actually, this can also be thought of as a[n+1]:=maxlongint div 2 div 2; It's just that the efficiency of bit operations is very high.

  10. Anonymous users2024-01-29

    maxlongint is the maximum value of longint, that is, 2 31-1, >>2 and shr 2 or div 4 are the same function, these 4 sentences are to assign the values of 1 n, n+1 and n+2 of the b array to (2 31-1) div 4

Related questions
3 answers2024-04-01

Strange indeed, the result of my experiment is that if the string variable is initialized first, the subscript can be used to read and write the string variable normally. >>>More

4 answers2024-04-01

The Pascal compilation system is a system software. Pascal is the first structured programming language with rigorous syntax, clear hierarchy, easy to write and readable programs. Pascal language is widely used in various software, and the program is divided into name (self-proposed after program), setting (defined after var), start (begin), program (body), read (read read ln), and end (end), with strong structural hierarchy, rigorous and tight. >>>More

3 answers2024-04-01

Simple pacal compiler implementation. rar] - This source code is a simple Pascal compiler implementation, implemented with the tools lex and yacc. >>>More

6 answers2024-04-01

Refer to the upstairs, but upstairs doesn't know then without adding a statement? >>>More

10 answers2024-04-01

Hotkey. Registration (Tab 1.)Take the window handle ()0, F1, > register F1 >>>More