M
M
MrFlatman2018-02-12 23:18:20
C++ / C#
MrFlatman, 2018-02-12 23:18:20

Translate code from C++ to pascal?

Hello everyone, I have a small piece of C++ code

#include<iostream>
    using namespace std;
     
    int main(){
    	int t, zedt;
    	while(true){
    		cin>>t;
    		if(t<=15)break;
    	}
    	zedt=15-t;
    	cout<<((double)t/15*100)<<"%\n"<<((double)zedt/15*100)<<"%\n";
    	return 0;
    }

It needs to be translated into Pascal, I tried it myself, as I understand it, but something did not grow together, tell me how to write it correctly?
program massiv;
var t,zedt,t1,t2: real;
begin
read(t);
while(true) {

if(t<=15)break;
}do
zedt:=15-t;
t1:=t/15*100;
t2:=zedt/15*100;
writeln(t1, t2);
end.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
3
3vi1_0n3, 2018-02-13
@3vi1_0n3

Didn't compile, but should be something like this:

program massiv;
var t,zedt,t1,t2: real;
begin
  while (true) do
  begin
    read(t);
    if (t<=15) then break;
  end;
  zedt:=15-t;
  t1:=t/15*100;
  t2:=zedt/15*100;
  writeln(t1, t2);
end.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question