Normally we would represent the days of the week using a low-level enumeration:
type
DayOfWeek (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday);
In other words, Sunday is represented by the integer 0, Monday by 1, Tuesday by 2, etc. This provides with a compact method of representing the high-level concept of a day of the week and the symbolic names are sufficiently abstract to make them easy to work with. However, it would be useful to convert these low-level symbolic constants to their higher-level equivalents (the actual strings, 'Sunday', 'Monday', 'Tuesday', etc) which can then be presented to the user. It would also be useful to be able to perform the reverse conversion, from high-level string to low-level enumeration. We achieve this with conversion functions implemented as lookup tables using case statements:
function ToDayOfWeekStr (Dow : DayOfWeek) : string;
begin
case Dow of
Sunday: ToDayOfWeekStr := 'Sunday';
Monday: ToDayOfWeekStr := 'Monday';
Tuesday: ToDayOfWeekStr := 'Tuesday';
Wednesday: ToDayOfWeekStr := 'Wednesday';
Thursday: ToDayOfWeekStr := 'Thursday';
Friday: ToDayOfWeekStr := 'Friday';
Saturday: ToDayOfWeekStr := 'Saturday';
end
end
function ToDayOfWeekEnum (Dow : string) : DayOfWeek;
begin
case Dow of
'Sunday': ToDayOfWeekEnum := Sunday;
'Monday': ToDayOfWeekEnum := Monday;
'Tuesday': ToDayOfWeekEnum := Tuesday;
'Wednesday': ToDayOfWeekEnum := Wednesday;
'Thursday': ToDayOfWeekEnum := Thursday;
'Friday': ToDayOfWeekEnum := Friday;
'Saturday': ToDayOfWeekEnum := Saturday;
else {handle input errors here};
end
end
There is no gotoxy statement in C.
write a c++ program to convert binary number to decimal number by using while statement
To write a C++ program to display the student details using class and array of object.
i dont no string for servlate
A = 5do{statement;A = A + 1;} while (A < 10)
There is no gotoxy statement in C.
Michael Yester has written: 'Using Turbo Pascal 6' -- subject(s): Pascal (Computer program language), Turbo Pascal (Computer file)
Thomas M. Boger has written: 'Programming fundamentals using Turbo Pascal' -- subject(s): Pascal (Computer program language), Turbo Pascal (Computer file)
write a c++ program to convert binary number to decimal number by using while statement
To write a C++ program to display the student details using class and array of object.
Kenneth L. Bowles has written: 'Problem solving using UCSD Pascal' -- subject(s): UCSD Pascal (Computer program language)
Arthur M. Keller has written: 'A first course in computer programming using PASCAL' -- subject(s): Pascal (Computer program language)
write a c++program by using if statement to read a number and check whether it is positive or negative
hey i m going to give a program that accepts edges a input and then it draws the graph using a computer graphics display...
Susan Finger has written: 'Pascal Programming for Engineers Using VPS' 'Advanced applications for Introduction to Pascal with applications in science and engineering' -- subject(s): Data processing, Engineering, Pascal (Computer program language), Science
Guy J. Hale has written: 'Applied data structures using Pascal' -- subject(s): Data structures (Computer science), Pascal (Computer program language)
i dont no string for servlate