Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

See attached file ...................

Views: 340


Replies to This Discussion

bahe in how form we submit this ......

run .cpp without the .txt file then the program won't run...we have to submit .cpp file only not .cpp+.txt

kia hum .tex file bhi upload kraan gay??????

thank u 4 this

( @ syed nashit. First we have to create a file through " c++ code"  and then Open file and read data from it and display it on the screen ) so no need to upload the .txt file.

read the Detailed Description:

Write a C++ program in which you have to: 

1. Create a text file “Electricity_Bill”.

2. Write following data in it:

3. Open file and read data from it and display it on the screen.

#include <fstream>

#include <iostream>
using namespace std;
int main()

{  char str[10];
  //Creates an instance of ofstream, and opens example.txt 

ofstream a_file ( "Electricity_Bill.txt" ); 

// Outputs to example.txt through a_file 

a_file"This text will now be inside of Electricity_Bill.txt"; 

// Close the file stream explicitly 


ifstream inFile;

char inputFileName[]="Electricity_Bill.txt";

const int MAX_CHAR_TO_READ = 100;

char completeLineText[MAX_CHAR_TO_READ];;


cout "Invalid file name: " inputFileName endl;





cout completeLineText endl;





hello friends i can create a text file through coding but unable to put the whole data in text file.please test this code and also help me how i put the full data into in


thanks dude!!!


zeeshan bhai yeh program tu sahi ban gia hai but data full enter nahi ho raha yehi just problem hai.ab file .text create b coding k through ho rahi hai aur read aur write b.just data ka problem hai.





© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service