473,698 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need text file code for this program

5 New Member
Help me i want to store data of this program to a text file. my compiler is Dev C++ . Data code for text file is in bold form
::Full code deleted, please post only the relevant text and errors::
Aug 5 '08 #1
3 1448
weaknessforcats
9,208 Recognized Expert Moderator Expert
Just create a file and use either the write or << methods to get your data to the file. Moderate research will solve your problem.

BTW: You should be using <iostream> and not <iostream.h>. iostream.h was pre-ANS C++ prior to 1998.
Aug 5 '08 #2
msalmanzaib
5 New Member
Help me i want to store data of this program to a text file. my compiler is Dev C++ . Data code for text file is in bold form
::::
Need code to write this data in a text file

Expand|Select|Wrap|Line Numbers
  1. void a::show()
  2. {
  3.     int n;
  4.     char number[5];
  5.     cout<<"Enter bus no: ";
  6.     cin>>number;
  7.     for(n=0;n<=p;n++)
  8.     {
  9.         if(strcmp(bus[n].busn,number)==0)
  10.             break;
  11.     }
  12.     while (n<=p)
  13.     {
  14.         vline('*');
  15.         cout<<" Bus no: \t"<<bus[n].busn
  16.         <<"\n Driver: \t"<<bus[n].driver<<"\t\t Arrival time:\t"
  17.         <<bus[n].arrival<<"\t Departure time:\t"<<bus[n].depart
  18.         <<"\n From:\t\t"<<bus[n].from<<"\t\t To: \t\t\t"<<
  19.         bus[n].to<<"\n";
  20.         vline('*');
  21.         bus[0].position(n);
  22.         int a=1;
  23.         for (int i=0;i<8;i++)
  24.         {
  25.             for(int j=0;j<4;j++)
  26.             {
  27.                 a++;
  28.                 if(strcmp(bus[n].seat[i][j],"Empty")!=0)
  29.                     cout<<"\n The seat no "<<a-1<<" is reserved for "<<bus[n].seat[i][j]<<" .";
  30.             }
  31.         }
Aug 5 '08 #3
newb16
687 Contributor
Do you have iostream reference manual, and, in particular, ofstream?
Aug 6 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3110
by: Spamtrap | last post by:
I only do occasional Perl programming and most things I write are short processes. I have something I'm working on that is scanning a text file with about 15 million lines and trying to extract matches from another text file, which has about 170 entries. The second text file is read into an array. The process then scans through the big file for certain possible patterns - it will find those in about 1 out of 25 lines,, when it finds one,...
4
2199
by: naknak4 | last post by:
Introduction This assignment requires you to develop solutions to the given problem using several different approaches (which actually involves using three different STL containers). You will implement all three techniques as programs. In these programs, as well as solving the problem, you will also measure how long the program takes to run. The programs are worth 80% of the total mark. The final 20% of the marks are awarded for a...
6
2123
by: naknak | last post by:
Introduction This assignment requires you to develop solutions to the given problem using several different approaches (which actually involves using three different STL containers). You will implement all three techniques as programs. In these programs, as well as solving the problem, you will also measure how long the program takes to run. The programs are worth 80% of the total mark. The final 20% of the marks are awarded for a...
29
51656
by: superc0red | last post by:
Hey. I have a big text file with data, and i want to extract mail addresses. How i can do it?
0
10766
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
0
8685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6532
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3053
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 we have to send another system
2
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.