473,395 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Not assignment rquest..having doof algorithms

That request of having sorting program for that setup programs was not
a request to an assignment but to have good ideas about sorting record
..
#include <stdio.h>
#include <conio.h>
struct customer_record /*Defining a csutomer record*/
{
int customer_no;
int no_of_weeks;
char tv_type;
};
main ()
{
/*-------1-open file for output*/
struct customer_record customer;
FILE *fp_setup;
if ((fp_setup=fopen("setup.txt","w")) == NULL)
{
printf("\nCan not open file 'setup.txt' for writing \n");
printf("Program is termainted");
exit();

}
clrscr();

/*-------2-while more customers----------separate function-------*/
do {
/*-------2-1-input customers record------separate function-------*/
customer_input(&customer);
/*-------2-2-write customer record to file*/
fprintf(fp_setup,"%4d%2d%c\n",customer);
} while (another_customer()=='y');
/*-------3-write end of file record to file */
fprintf(fp_setup,"%4d%2d%c\n",9999,99,' ');
/*-------4-close file*/
fclose(fp_setup);
return 0;
}
customer_input(cust)
/*---------------------*/
struct customer_record *cust;
{
printf("\nEnter customer number :");
scanf("%4d",&(*cust).customer_no);
printf("\nEnter number of weeks rent due :");
scanf("%2d",&(*cust).no_of_weeks);
printf("Enter type of rental -c for colors TV");
printf("\n -b for black and white TV");
printf("\n -v for video");
printf("\n -o for other : ");
scanf("\n");
scanf("%c",&(*cust).tv_type);
}
another_customer()
/*----------------*/
{
char another;
printf("\nAnother new_screen_customer for input (y or n) : ");
scanf("\n");
scanf("%c",&another);
return (another);
}

Nov 14 '05 #1
0 1097

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Paul Rubin | last post by:
OK, I want to scan a file for lines matching a certain regexp. I'd like to use an assignment expression, like for line in file: if (g := re.match(pat, line)): croggle(g.group(1)) Since...
0
by: happy | last post by:
That request of having sorting program for such setup programs was not a request to an assignment but to have good ideas about sorting program .. #include <stdio.h> #include <conio.h> struct...
34
by: Chris | last post by:
Is there ever a reason to declare this as if(*this == rhs) as opposed to what I normally see if(this == &rhs) ?
11
by: efrat | last post by:
Hello, I'm planning to use Python in order to teach a DSA (data structures and algorithms) course in an academic institute. If you could help out with the following questions, I'd sure...
1
by: momo | last post by:
Hi everybody, I have to implement a routing and wavelength assignment problem (RWA) for a given optical network. I ve implemented the network graph in C using linked list. the shortest-path...
26
by: vlsidesign | last post by:
I am a newbie and going through "The C programming language" by Kernighan & Richie on my own time (I'm not a programmer but I want to learn because it can save me time in my normal job, and it is...
53
by: Vicent Giner | last post by:
Hello. I am new to Python. It seems a very interesting language to me. Its simplicity is very attractive. However, it is usually said that Python is not a compiled but interpreted programming...
9
by: puzzlecracker | last post by:
From my understanding, if you declare any sort of constructors, (excluding copy ctor), the default will not be included by default. Is this correct? class Foo{ public: Foo(int); // no...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.