Help for designing outlines in c language

W

Walter Roberson

The C language itself only provides for text, and not graphics.
If you were thinking of graphical menus (e.g., pop-up or drop-down
menus) then you need operating system dependant extensions and you should
ask about those in a newsgroup appropriate for your operating system.

Even if you were just thinking about text-only menus and borders,
you cannot portably do what you want in standard C, as C does not
have any notion of "screen" or font or how characters show up on displays.
C also does not have any notion of where things are on whatever
output device is being used, so you cannot portably position particular
information at particular locations.
 
S

Simon Biber

Manmeet said:
Hi all this is Manmeet Mittal,
I want to create menus and borders in c. How can make it. What r its codings.

#include <stdio.h>

int main(void)
{
int choice = 0;
while(choice != 4)
{
puts(
"|------------------------|\n"
"| MAIN MENU |\n"
"|------------------------|\n"
"| 1. Add |\n"
"| 2. Subtract |\n"
"| 3. Multiply |\n"
"| 4. Quit |\n"
"|------------------------|\n");
scanf("%d", &choice);
switch(choice)
{
case 1: puts("Adding"); break;
case 2: puts("Subtracting"); break;
case 3: puts("Multiplying"); break;
case 4: break;
default: puts("Invalid choice");
}
}
return 0;
}
 
W

Walter Roberson

Manmeet Mittal wrote:
puts(
"|------------------------|\n"
"| MAIN MENU |\n"
"|------------------------|\n"
"| 1. Add |\n"
"| 2. Subtract |\n"
"| 3. Multiply |\n"
"| 4. Quit |\n"
"|------------------------|\n");

That assumes a fixed width font, which is not a portable assumption.

It also assumes that the display is at least 26 wide by 8 high,
which is also not portable.
 
S

Skarmander

Walter said:
That assumes a fixed width font, which is not a portable assumption.

It also assumes that the display is at least 26 wide by 8 high,
which is also not portable.

Heck, it assumes *a* display, which is not portable. There's no way to do
"menus and borders" in the way the OP presumably intends in portable C, so
it hardly matters.

S.
 
S

Skarmander

Skarmander said:
There's no way to do "menus and borders" in the way the OP presumably
intends in portable C, so it hardly matters.
Necessary correction: there's no way to do it in portable *standard* C.
Portability is, of course, a matter of degree.

S.
 
K

Keith Thompson

The ">" characters you see at the beginnings of lines in Usenet
postings have a specific meaning. They denote text that is quoted
from previous articles. Please don't add them to your own new text.
If you post a followup, your newsreader (or, in your case, the Google
Groups interface) will insert them for you.
 
S

Simon Biber

Walter said:
That assumes a fixed width font, which is not a portable assumption.

It also assumes that the display is at least 26 wide by 8 high,
which is also not portable.

With a proportional font it will still work, but just look weird.

What hosted C environment has a display less than 26x8 characters?

My program will also work on teletype printer terminals -- it does not
require a display.
 
W

Walter Roberson

Walter said:
With a proportional font it will still work, but just look weird.

With a proportional font, it is unlikely to fullfill the requirement
of having a "border". For example in the font 'ariel', the trailing
bar of several lines align with the end fof the U of the word
MENU .

What hosted C environment has a display less than 26x8 characters?

Windows on PalmOS might well be that small.
My program will also work on teletype printer terminals -- it does not
require a display.

teletypes sometimes have proportional fonts.
 
H

Herbert Rosenau

I've never seen a TTY that had not a fixed font.

No, it works on classic TTY.

Proven on DEC Eclipse about 20 years ago. That was the method the game
startec had woked.
Heck, it assumes *a* display, which is not portable.

No, except you'll say that a TTY is a screen.

There's no way to do
"menus and borders" in the way the OP presumably intends in portable C, so
it hardly matters.

Not true as old classic gaemes written for TTYs and green color
monitors have already proven.

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2 Deutsch ist da!
 
H

Herbert Rosenau

With a proportional font it will still work, but just look weird.

What hosted C environment has a display less than 26x8 characters?

What lets you think that each hosted environment has a need for such
displays? I've seen man whereas the display is only one single line
LCD display, having a console with keyboard and TTY like printer.
My program will also work on teletype printer terminals -- it does not
require a display.


--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2 Deutsch ist da!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top