Kezdőoldal » Számítástechnika » Programozás » Hol rontottam el? Mit javítsak...

Hol rontottam el? Mit javítsak? (Pascal)

Figyelt kérdés

program quiz;

uses crt;

begin

clrscr;

write('QUIZ, made by LastWild');

readln;

end;

var

counter : integer;

input : char;

begin

counter:=0;

writeln('Welcome');

readln;

clscr;

Writeln('What color is a rubberduck usually?');

Writeln('1. red');

writeln('2. yellow');

readln(input);

if (input=2) then counter=counter+1;

if (input=2) then write('Correct!')

else write('error');

end;

readln;

clrscr;

writeln('Which is the bigger one?');

writeln('1. Dog');

writeln('2. Cat');

if (input=1) then counter=counter+1;

if (input=1) then write('Correct!')

else

write('error');

end;

readln;

clrscr;

writeln('Which has the longer neck?');

writeln('1. Elephant');

Writeln('2. Giraffe');

if (input=2) then counter=counter+1;

if (input=2) then write('Correct!')

else

write('error');

readln;

end;

clrscr;

Writeln('Lets see your total points!');

readln;

write('You have:');

readln;

write(counter);

readln;

if (counter=1) then write ('Idiot!!!!!!!');

if (counter=2) then write ('Average...')

else write('Congratulations,you just achieved the name of the Biggest stupid on the earth!!');

readkey;

end.


2011. aug. 30. 19:51
 1/5 A kérdező kommentje:
nagyon ne oltsatok le,merr ez a második napom a pascallal,és mindenféle programozással :)
2011. aug. 30. 19:53
 2/5 zsomkovacs ***** válasza:

Hát, van benne jópár hiba...


1) Az elején, a Var előtt van egy Begin..End; részed. A Begin és End közti részt másold a Var utáni Begin után, és a Var előtt csak a program quiz; uses crt; maradjon.

2) Az Else kulcsszavak után az utolsó kivételével mindegyiknél írj Begin-t.

3) Az utolsó Readkey;-t meg írd át ReadLn-re. Függvényt csak {$X+} mellett hívhatsz eljárásként, de nem biztos, hogy a Pascalod így van beállítva.


Most csak ennyi hibát látok. És légy szíves legközelebb megadni, hogy milyen hibát ad a Pascal, mert úgy sokkal könnyebb megtalálni a hibás részt.

2011. aug. 30. 20:56
Hasznos számodra ez a válasz?
 3/5 anonim ***** válasza:

Picit sok benne az end, nem?

Valami ilyesmi:


program quiz;

uses crt;

var

counter : integer;

input : char;

begin

clrscr;

write('QUIZ, made by LastWild');

readln;

counter:=0;

writeln('Welcome');

readln;

clscr;

Writeln('What color is a rubberduck usually?');

Writeln('1. red');

writeln('2. yellow');

readln(input);

if (input=2) then

counter=counter+1;

if (input=2) then

write('Correct!')

else

write('error');

readln;

clrscr;

writeln('Which is the bigger one?');

writeln('1. Dog');

writeln('2. Cat');

if (input=1) then

counter=counter+1;

if (input=1) then

write('Correct!')

else

write('error');

readln;

clrscr;

writeln('Which has the longer neck?');

writeln('1. Elephant');

Writeln('2. Giraffe');

if (input=2) then

counter=counter+1;

if (input=2) then

write('Correct!')

else

write('error');

readln;

clrscr;

Writeln('Lets see your total points!');

readln;

write('You have:');

readln;

write(counter);

readln;

if (counter=1) then

write ('Idiot!!!!!!');

if (counter=2) then write

('Average...')

else

write('Congratulations,you just achieved the name of the Biggest stupid on the earth!!');

readkey;

end.


Nem teszteltem, úgyhogy lehet hibás, de legközelebb megoszthatnád, hogy mi is a hiba (pl. fordító mit dobott vissza, stb.).

2011. aug. 30. 21:01
Hasznos számodra ez a válasz?
 4/5 anonim ***** válasza:

Szintaktikailag így nem hibás:


program quiz;

uses crt;

var

counter,input : integer;

begin

clrscr;

write('QUIZ, made by LastWild');

readln;

counter:=0;

writeln('Welcome');

readln;

clrscr;

Writeln('What color is a rubberduck usually?');

Writeln('1. red');

writeln('2. yellow');

readln(input);

if (input=2) then

counter:=counter+1;

if (input=2) then

write('Correct!')

else

write('error');

readln;

clrscr;

writeln('Which is the bigger one?');

writeln('1. Dog');

writeln('2. Cat');

if (input=1) then

counter:=counter+1;

if (input=1) then

write('Correct!')

else

write('error');

readln;

clrscr;

writeln('Which has the longer neck?');

writeln('1. Elephant');

Writeln('2. Giraffe');

if (input=2) then

counter:=counter+1;

if (input=2) then

write('Correct!')

else

write('error');

readln;

clrscr;

Writeln('Lets see your total points!');

readln;

write('You have:');

readln;

write(counter);

readln;

if (counter=1) then

write ('Idiot!!!!!!');

if (counter=2) then write

('Average...')

else

write('Congratulations,you just achieved the name of the Biggest stupid on the earth!!');

readkey;

end.


Aki 1-et tudott az idióta aki 0-át az nem a program szerint, érdekes.

2011. aug. 30. 21:28
Hasznos számodra ez a válasz?
 5/5 A kérdező kommentje:

köszi utolsó,a tied jó volt...

akkor ezek szerint nem kell bele az a sok end...valamit csúnyán félreértelmeztem. átalakítottam a végét,mostmár nullára is idiótázik :) plusz találtam benne még egy szépséghibát,túl hama irta hogy correct vagy error,még az előtt,hogy adatot adtam meg neki... azt is javítottam. köszönöm mindenkinek a segítséget!

2011. aug. 30. 21:58

Kapcsolódó kérdések:





Minden jog fenntartva © 2024, www.gyakorikerdesek.hu
GYIK | Szabályzat | Jogi nyilatkozat | Adatvédelem | Cookie beállítások | WebMinute Kft. | Facebook | Kapcsolat: info(kukac)gyakorikerdesek.hu

A weboldalon megjelenő anyagok nem minősülnek szerkesztői tartalomnak, előzetes ellenőrzésen nem esnek át, az üzemeltető véleményét nem tükrözik.
Ha kifogással szeretne élni valamely tartalommal kapcsolatban, kérjük jelezze e-mailes elérhetőségünkön!