473,398 Members | 2,404 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,398 software developers and data experts.

Not assignment request..having good algorithms

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 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 986

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: Oplec | last post by:
Hello, I am learning the C++ programming language as a hobby. I have found some useful links such as the C++ FAQ Lite, Flipcode, Gamedev, and Gamasutra that are good for information/help. However,...
3
by: Filipe Henriques | last post by:
Hello, I'm having some problems using the Report Manager, but I *really* need to make a role assignment now. Can't wait to have the problem with Report Manager solved. So, I would like to make...
16
by: Edward Diener | last post by:
Is there a way to override the default processing of the assignment operator for one's own __value types ? I realize I can program my own Assign method, and provide that for end-users of my class,...
17
by: N4M | last post by:
Dear, Suppose I have a Protocol class, in which I need also an assignment operator =(). class B { ..... virtual B& operator=(const B& rb) =0; }; Now in some derived class D: public B, how...
14
by: Tony Johansson | last post by:
Hello Experts! Assume I have a class called SphereClass as the base class and a class called BallClass that is derived from the SphereClass. The copy constructor initialize the left hand object...
0
by: happy | last post by:
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...
113
by: Bonj | last post by:
I was in need of an encryption algorithm to the following requirements: 1) Must be capable of encrypting strings to a byte array, and decyrpting back again to the same string 2) Must have the same...
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) ?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
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 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.