-
var a:real;
beginread(a);
write(a);
write(trunc(a));
write(a-trunc(a));
write(round(a));
end.If you have a function with truncated decimals, it's useless if you don't let it be used.
I had time to do the rest, etc
-
The function of arrays: to facilitate the recording of data, for example:
If we want to read 10 numbers, if we don't use arrays, then we need to open 10 variables such as a1, a2, a3, a4...a10。
In the same way, if you want to read 100 numbers -- you have to open 100 variables.
arrays can be easily stored and used;
For example, a:array[1..100] of longint/integer;
What the array does:
It is used to record, store, modify, and output data (which can be a large amount);
The type of the 2nd floor is the same, and the role does not have to be the same;
Usage: When you want the ith data, the array you define is a[i] a[i] a[i] is equivalent to an integer or a long integer.
For all the functions of pascal, just remember a few common ones, such as:
inc(a);dec(a); ord(ch/string);chr(a);fillchar(a,sizeof(a),k) (in parentheses are variables), etc.
If you want to list all the various tutorials at the back of them, it's too painful to list them all one by one
Loop statement: for : for i:=p to q do begin .end;where i, p, q are (long) integers;
while: while condition do if this condition is met, otherwise it jumps out. begin
end;repeat: repeat
until condition; If a condition is met, I jump out and perform otherwise.
The main difference between while repeat is that while is to judge first and then do, and repeat is to do first and then judge;
while is satisfied to do, otherwise skip;
repeat is not satisfied to do, satisfied escaped;
These three are the most commonly used.
It is also mainly these three kinds of circular statements;
Alas, exhausted - -
Also, I'm afraid it's not good to copy and paste like this on the 2nd floor
Smart people around me.
My mom is a smart person. She has bright eyes, is of medium height, and has long jet-black hair. My mom always came up with a lot of good ideas. >>>More
As soon as the car came to a stop, the person did not get clean, and he jumped up in one step (cuān). It's called getting the first shot, in order to get a seat first. >>>More
This sentence is either contradictory or pretend.
It's not a problem that pascal can solve, it's not a panacea!!
Refer to the upstairs, but upstairs doesn't know then without adding a statement? >>>More