write() will just be a line of text and writeln() will be a line of text that puts the next writeln() on another line
This would depend on what programming language you wanted to write it in. For example, in Pascal, the code might look like this: Program Isosceles; Var A, B, C : Real; Begin WriteLn('Input side A.'); ReadLn(A); WriteLn('Input side B.'); ReadLn(B); WriteLn('Input side C.'); ReadLn(C); If A = B Then Begin If B = C Then Begin WriteLn('This triangle is equilateral.'); End Else Begin WriteLn('This triangle is isosceles.'); And so on.
Well if you want to create a menu, you may use CASE.This is the programprogram Menu;var menu:integer;beginwriteln('Menu');writeln('1. XXXXXXX');writeln('2. XXXXXXX'); {unlimited option you want}writeln; {just to make it pretty :)}write('Mode you want to choose');readln(menu);CASE menu OF1: {program if I choose 1 from the menu};2: {program if I choose 2 from the menu};end; {end of case}readln;end.
{Area s the area of cube} {Length is the length of one side of the cube} program AreaofCube; var Area,Length:real; begin write('Enter the length of cube: '); readln(Length); Area:=6*(Length*Length); writeln('The area of cube is ', Area, ' cm^2.'); end.
The readline statement method of programming will allow for the next statement in the sequence to be read. The writeline method of programming only allows for the current statement or sequence to be read after determining the end of the last line.
write() will just be a line of text and writeln() will be a line of text that puts the next writeln() on another line
{A program to compute the area of a triangle} {by Ogboin W. Meshach} Var; b,h:real; BEGIN Writeln('Triangle'); Write('Base: '); Readln(base); Write('Height: '); Readln(height); area:=0.5*base*height; Writeln('Area: ', area :0:2); End.
This would depend on what programming language you wanted to write it in. For example, in Pascal, the code might look like this: Program Isosceles; Var A, B, C : Real; Begin WriteLn('Input side A.'); ReadLn(A); WriteLn('Input side B.'); ReadLn(B); WriteLn('Input side C.'); ReadLn(C); If A = B Then Begin If B = C Then Begin WriteLn('This triangle is equilateral.'); End Else Begin WriteLn('This triangle is isosceles.'); And so on.
Well if you want to create a menu, you may use CASE.This is the programprogram Menu;var menu:integer;beginwriteln('Menu');writeln('1. XXXXXXX');writeln('2. XXXXXXX'); {unlimited option you want}writeln; {just to make it pretty :)}write('Mode you want to choose');readln(menu);CASE menu OF1: {program if I choose 1 from the menu};2: {program if I choose 2 from the menu};end; {end of case}readln;end.
i mean unit hospital; interface uses crt; implementation Var name:string; typeofroom,tp,tv:char; month, day, year, daysstayed,roomcharge,tpcharge,tvcharge,nory1,nory2,totalcharge:integer; const pc=125; sc=95; Wc=75; Tvc=3.50; Tpc=1.75; begin //prompting writeln('please enter the patients''s name':44); readln(name); writeln('please enter the number of days stayed in the hospital':63); readln(daysstayed); writeln('please write the month':31); readln(month); writeln('please write the day':29); readln(day); writeln('pelase enter the year':30); readln(year); writeln('please enter y or n for which typeofroom you used. P for private, S for semi private, and W for ward':57); readln(typeofroom); Case typeofroom of 'P':roomcharge:=(pc*daysstayed); 's':roomcharge:=(sc*daysstayed); 'w':roomcharge:=(wc*daysstayed); end; writeln('enter y or n for yes or no if they used the telephone':62); readln(nory1); Case tpcharge of 'Y':(tpcharge:=tpc*daysstayed); 'N':(tpcharge:=0); end; writeln('enter y or n for yes or no if they used the television':63); readln(nory2); Case tvcharge of 'Y':(tvcharge:=Tvc*daysstayed); 'N':(tvcharge:=0); end; //computing Totalcharge:=roomcharge+tvcharge+tpcharge; // end.
Here is an example Pascal code snippet that converts a number into words: program NumberToWords; var num: integer; begin write('Enter a number: '); readln(num); case num of 1: writeln('One'); 2: writeln('Two'); // add more cases for other numbers here else writeln('Number not supported'); end; readln; end. You can extend the case statement to handle more numbers and their corresponding words.
{Area s the area of cube} {Length is the length of one side of the cube} program AreaofCube; var Area,Length:real; begin write('Enter the length of cube: '); readln(Length); Area:=6*(Length*Length); writeln('The area of cube is ', Area, ' cm^2.'); end.
Type your answer here... WHAT IS DIFFERENCE BETWEEN WRIGHT AND RIGHT
I think you mean written statement. What you are asking about write statement you are confusing with written statement, the same with write in statement. A written statement is simply putting your words, or your version of events in writing.
The readline statement method of programming will allow for the next statement in the sequence to be read. The writeline method of programming only allows for the current statement or sequence to be read after determining the end of the last line.
Write off is the difference between total charge and the allowable amount by the insurace. Write off is the difference between total charge and the allowable amount by the insurace.
Uses SysUtils; Type TGuessStatusArray = Array[1..20] Of Char; TLettersGuessedArray = Array[1..26] Of Char; Var NewPhrase : String; PhraseHasBeenSet : Boolean; PhraseGuessed : Boolean; Choice : Integer; GuessStatusArray : TGuessStatusArray; LettersGuessedArray : TLettersGuessedArray; NextGuessedLetter : Char; Index : Integer; Procedure DisplayMenu; Begin Writeln('__________________________________'); Writeln; Writeln('1. SETTER - Makes new word/phrase'); Writeln; Writeln('2. USER - Next letter guess'); Writeln; Writeln('5. End'); Writeln; End; Function GetNewPhrase : String; Var PhraseOK : Boolean; ThisNewPhrase : String; Begin Repeat Write('Key in new phrase ...(letters and any Spaces) '); Readln(ThisNewPhrase); If Length(ThisNewPhrase) < 10 Then Begin PhraseOK := False; Writeln('Not enough letters ... '); { possible further validation check(s) } End Else Begin PhraseOK := True; GetNewPhrase := ThisNewPhrase; End; Until PhraseOK = True; End; Procedure SetUpGuessStatusArray(NewPhrase : String; Var GuessStatusArray : TGuessStatusArray); Var Position : Integer; Begin For Position := 1 To Length(NewPhrase) Do Begin If NewPhrase[Position] = ' ' Then GuessStatusArray[Position] := ' ' Else GuessStatusArray[Position] := '*'; End; End; Procedure DisplayCurrentStatus(PhraseLength : Byte; GuessStatusArray : TGuessStatusArray); Var Position : Integer; Begin For Position := 1 To PhraseLength Do Write(GuessStatusArray[Position]); Writeln; End; Function GetNextLetterGuess : Char; Var Position : Integer; GuessedLetter : Char; Begin Writeln; Write('Next guess ? '); Readln(GuessedLetter); GetNextLetterGuess := GuessedLetter; End; Function AllLettersGuessedCorrectly(GuessStatusArray: TGuessStatusArray; NewPhrase : String) : Boolean; Var Position : Integer; MissingLetter : Boolean; Begin MissingLetter := False; Position := 1; Repeat If GuessStatusArray[Position] <> NewPhrase[Position] Then MissingLetter := True Else Position := Position+1; Until (MissingLetter = True) or (Position = Length(NewPhrase)+1); If MissingLetter = False Then AllLettersGuessedCorrectly := True Else AllLettersGuessedCorrectly := False; End; { Main program block starts here } Begin PhraseHasBeenSet := False; Repeat DisplayMenu; Write('Choice? '); Readln(Choice); If Choice = 1 Then Begin NewPhrase := GetNewPhrase; SetUpGuessStatusArray(NewPhrase, GuessStatusArray); PhraseHasBeenSet := True; End; If Choice = 2 Then Begin If PhraseHasBeenSet = True Then Begin DisplayCurrentStatus(Length(NewPhrase), GuessStatusArray); NextGuessedLetter := GetNextLetterGuess; For Index := 1 To Length(NewPhrase) Do If NextGuessedLetter = NewPhrase[Index] Then GuessStatusArray[Index] := NextGuessedLetter; DisplayCurrentStatus(Length(NewPhrase), GuessStatusArray); PhraseGuessed := AllLettersGuessedCorrectly(GuessStatusArray,NewPhrase); If PhraseGuessed = True Then Writeln('You have guessed correctly'); End Else Writeln('The setter has not specified the word/phrase ..'); End; If (Choice = 5) And (PhraseGuessed = False) Then Begin Writeln('You have not completed this word/phrase...Press return to exit'); Readln; End; Until Choice = 5; End.