(in C programing)
who knows the name of some function which can be used for printing tables or for printing some colorful outputs?
i want to print some data in red color and also want to print and scan some data in table,what shuold i do?
7 3378 Ganon11 3,652
Recognized Expert Specialist
Please do not double-post your questions. It will not help them get answered more quickly, it only clutters up the thread list. The second topic has been deleted.
Banfa 9,065
Recognized Expert Moderator Expert
colour printing depends entirely on the platform you are using. We will need to know the platform to be able to help.
well,i actually don't understand what you mean from"platform "...!
if you mean the style of my program...well,i have to write a program which make a file for storring data and then using these data in some function...
(data will be taken in form of structures) .here is a piece of this: - #include<stdio.h>
-
#include<conio.h>
-
#include<stdlib.h>
-
#include<string.h>
-
struct INFORMATION{
-
long student_number;
-
char first_name[20];
-
char last_name[20];
-
float grade[100];
-
int grade_number;
-
int unit[100];}info[50];
-
int menu(void);
-
void add_student(void);
-
void view_student(void);
-
void main()
-
{
-
clrscr();
-
for(;;)
-
switch(menu()){
-
case 1 : add_student(); break;
-
case 2 : view_student(); break;
-
case 6 : exit(1);
-
}/*End of switch & for*/
-
}/*End of main*/
-
int menu(void)
-
{
-
int index;
-
do{ clrscr();
-
gotoxy(5,5);
-
printf("<<menu of choices:>>");
-
gotoxy(5,7);
-
printf("1) Adding a student.");
-
gotoxy(5,9);
-
printf("2) viewing a student's information.");
-
gotoxy(5,11);
-
printf("3) Editting a student's information.");
-
gotoxy(5,13);
-
printf("4) Deleting a student.");
-
gotoxy(5,15);
-
printf("5) List of students' information.");
-
gotoxy(5,17);
-
printf("6) Exit setup.");
-
gotoxy(5,19);
-
printf("enter you select,then press Enter key:");
-
scanf("%d",&index);}
-
while(6<=index && index<=1);
-
return index;
-
}/*End of menu function*/
-
//**************************
-
void add_student()
-
{
-
FILE *ptfile;
-
static int m=0;
-
int course_no=0, index, index1;
-
char strno[20];
-
clrscr();
-
getch();
-
ptfile=fopen("fmain.dat","a");
-
if(!ptfile)
-
{printf("\n can not open the file.");
-
getch();
-
exit(1);}
-
for(index=0 ; index<50 ;index++)
-
{ info[index].first_name[0]='\0' ;
-
info[index].last_name[0]='\0' ;
-
info[index].grade[0]='\0' ;
-
info[index].unit[0]='\0' ;
-
info[index].student_number=0;
-
info[index].grade_number=0;}
-
info[m].grade_number=0;
-
gotoxy(5,5);
-
printf("Please enter the student number:");
-
scanf("%s",strno);
-
info[m].student_number=atoi(strno);
-
gotoxy(19,7);
-
printf("first name :"); scanf("%s",info[m].first_name);
-
gotoxy(19,9);
-
printf("last name :"); scanf("%s",info[m].last_name);
-
gotoxy(19,11);
-
printf(" number of courses :");
-
scanf("%d",&course_no);
-
for(index1=0 ; index1<course_no ;index1++)
-
{gotoxy(19,13);
-
printf("grade of course number %d .",index1+1);
-
scanf("%s",strno);
-
info[m].grade[index1]=atoi(strno);
-
gotoxy(19,15);
-
printf("unit of course number %d .",index1+1);
-
scanf("%s",strno); info[m].unit[index1]=atoi(strno);
-
-
(info[m].grade_number)+=(info[m].grade[index1])*(info[m].unit[index1]);}
-
(info[m].grade_number)/=course_no ;
-
fwrite( &info[m] , sizeof(INFORMATION), 1 ,ptfile);
-
m++;
-
fclose(ptfile);
-
printf("Press any key to continue...");
-
getch();
-
}
-
void view_student()
-
{
-
clrscr();
-
FILE *ptfile;
-
long number=0,variable=0;
-
char strno[20];
-
int index=0 ,index1;
-
ptfile=fopen("fmain.dat","r");
-
if(!ptfile)
-
{ printf("can not open the file.");
-
getch();
-
exit(1);}
-
printf("Please enter the student's number:\n");
-
scanf("%s",strno); number=atoi(strno);
-
fread( &info[index], sizeof(INFORMATION) ,1,ptfile);
-
for( index=0 ; !feof(ptfile) ;index++)
-
{ if(number==info[index].student_number)
-
{
-
gotoxy(5,5);
-
printf("number: %ld",info[index].grade_number);
-
gotoxy(5,6);
-
printf("first name: %s",info[index].first_name);
-
gotoxy(5,7);
-
printf("last name: %s",info[index].last_name);
-
gotoxy(5,9);
-
printf("avrage: %d",info[index].grade_number);
-
gotoxy(5,10) ;
-
for(index1=1; info[index].grade;index1++)
-
-
{printf("%d) %f %d",index1,info[index].grade[index1],info[index].unit[index1]);
-
gotoxy(5,10+index);
-
}
-
variable=number;
-
}
-
fread( &info[index+1], sizeof(INFORMATION) ,1,ptfile);
-
}
-
if(!variable)
-
printf("can not find the student\n");
-
fclose(ptfile);
-
printf("press any keyto continue...");
-
getch();
-
-
}/*End of view_student*/
-
//****************************************
-
Banfa 9,065
Recognized Expert Moderator Expert
colour printing depends entirely on the platform you are using. We will need to know the platform to be able to help.
By platform I mean
What OS
What Compiler
What Computer/CPU Chipset
By platform I mean
What OS
What Compiler
What Computer/CPU Chipset
microsoft
Turbo C++ 4.5
intel(R)
Banfa 9,065
Recognized Expert Moderator Expert
I believe the Borland C++ has a function cprint or cprintf that outputs in colour. But you will have to look it up as I do not know anything about it.
Ganon11 3,652
Recognized Expert Specialist
You can also use a system() call to generate basic background and text colors. Open up a command prompt and type "color fg" to get the basics on how it works. In your program, you will use a call like
where X and Y are color constants that you will see in your command prompt when you test it out.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Liren Zhao |
last post by:
I use some "Console.WriteLine(some strings here)" to
display some
debug information in my winform program.
How can I get the information in my programe or same them
in a text file ?
|
by: Bob |
last post by:
I just recently noticed that when I start my applicatoin in debug mode, the IDE
hangs (no disk or CPU activity) indefinitely (at least 20 minutes). Pausing the
application shows that it's hung up...
|
by: Steve |
last post by:
I have created a console app that simply prints out a message a couple
times, then exits, here is the code:
<code>
for(int i = 0; i < 10; i++)
{
System.Threading.Thread.Sleep(500);...
|
by: lavu |
last post by:
I currently have a C# windows Application . I would like this App to
work through an command line interface also. I would like to specify
command line params, which should start the app and process...
|
by: Anton81 |
last post by:
Hi all!
I used escape sequences to produce colour output, but a construct like
print "%8s" % str_with_escape
doesn't do the right thing. I suppose the padding counts the escape
characters,...
| |
by: gurdz |
last post by:
Does anyone know how to change the colour of the text in the console in
C??
|
by: skeete1990 |
last post by:
heres my code there 1 problem with it (its bolded) its not going through its a math type things if any one can help me please help all i ask is that you no change the code too much if possible, heres...
|
by: pratap |
last post by:
I have an application which periodically gives me an output of sonar
values .However i am unable to view the values as they get replaced by
the new ones below in realtime and are displayed after...
|
by: mquincey |
last post by:
One of the features offered by .NET 2.0 is the use of the TraceSource class. In an attempt to demonstrate its use, I wanted to run my test under the following conditions:
1. Use TraceSource class...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |