php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CS201 Introduction to ProgrammingAssignment No. 03 Semester Fall 23 December 2011
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#6
Code:
[B]<iostream.h> #include <string.h> #include <stdlib.h> #include <fstream.h> using namespace std; int random(int i) { return rand()%i; } struct Reservation { string Passenger_Name; string Passenger_Address; string Date_of_Flight; string Destination_to_travel; int Flight_No; int Seat_No; }; void GetData(Reservation[],int); void WriteData(Reservation[], int); void ReadData(Reservation[], int); main() { Reservation *res; Quote:#include int i; cout<<"How many reservation you want: "; cin>>i; res = new Reservation[i]; GetData(res, i); system("pause"); } void GetData(Reservation st[], int nn) { string n; char ch; int l; for(int j=1;j<=nn;j++) { cout<<"Enter Passenger Name for Passenger "<<j<<" : "; cin>>n; st[j-1].Passenger_Name=n; cout<<"Enter Passenger Address for Passenger "<<j<<" : "; cin>>n; st[j-1].Passenger_Address=n; cout<<"Enter Date of Flight for Passenger "<<j<<" : "; cin>>n; st[j-1].Date_of_Flight=n; cout<<"Enter Destination_to_travel for Passenger "<<j<<" : "; cout<<"Please Select from given"<<endl; cout<<"k for karachi"<<endl; cout<<"p for peshawar"<<endl; cout<<"L for lahore"<<endl; cin>>ch; if( ch == 'p') { st[j-1].Destination_to_travel="Peshawar"; st[j-1].Flight_No=233; st[j-1].Seat_No=random(200); } if( ch == 'k') { st[j-1].Destination_to_travel="Karachi"; st[j-1].Flight_No=201; st[j-1].Seat_No=random(200); } if( ch == 'l') { st[j-1].Destination_to_travel="Lahore"; st[j-1].Flight_No=241; st[j-1].Seat_No=random(200); } else if( !(ch == 'p' || ch == 'k' || ch == 'l')) { cout<<"Please select from list:"<<endl; } } WriteData(st, nn); } void WriteData(Reservation abc[], int nn) { ofstream myfile ("abc.txt"); if (myfile.is_open()) { for(int j=1;j<=nn;j++) { myfile <<abc[j-1].Passenger_Name<<endl; myfile <<abc[j-1].Passenger_Address<<endl; myfile <<abc[j-1].Date_of_Flight<<endl; myfile <<abc[j-1].Destination_to_travel<<endl; myfile <<abc[j-1].Flight_No<<endl; myfile <<abc[j-1].Seat_No<<endl; } myfile.close(); } else cout << "Unable to open file"; ReadData(abc, nn); } void ReadData(Reservation[], int) { string line; ifstream myfile ("abc.txt"); if (myfile.is_open()) { while ( myfile.good() ) { getline (myfile,line); cout << line << endl; } myfile.close(); } else cout << "Unable to open file"; }[/B]

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Messages In This Thread
CS201 Introduction to ProgrammingAssignment No. 03 Semester Fall 23 December 2011 - by Vuhelper - 12-29-2011, 04:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Assignment No. 3 Semester: Spring 2015 Computer Network- CS610 Xpert 0 928 07-29-2015, 04:45 PM
Last Post: Xpert
  cs402 first semester first assignment spring may 2015 Xpert 0 2,873 05-15-2015, 03:39 AM
Last Post: Xpert
  mcs cs408 assignment no 1 for may spring 2015 semester for virtual university Xpert 0 1,770 05-15-2015, 03:28 AM
Last Post: Xpert
  first semester assignment of cs604 spring may 2015 with final solution 2015 Xpert 0 2,724 05-15-2015, 03:20 AM
Last Post: Xpert
  cs304 first may spring semester for mcs 2015 final solution Xpert 0 1,237 05-15-2015, 03:11 AM
Last Post: Xpert
  cs201 assignment no 1 may 2015 solution Xpert 0 3,050 05-15-2015, 03:06 AM
Last Post: Xpert
  Virtual university MCS online tuition and helping forum for fall 2014 Semester Xpert 0 1,337 09-28-2014, 05:19 PM
Last Post: Xpert
  CS507 Information System Assignment No. 03 Solution Spring Semester June 2013 Vuhelper 6 2,368 06-21-2013, 04:11 AM
Last Post: Xpert
  ECO402 Microeconomics Assignment No.2 Solution Spring Semester 2013 Vuhelper 0 2,893 06-20-2013, 10:08 PM
Last Post: Vuhelper
  CS302 Digital Logic Design Assignment No.3 Solution Spring Semester 2013 Vuhelper 0 3,508 06-20-2013, 04:53 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support