Untitled
unknown
plain_text
2 years ago
920 B
4
Indexable
#include <iostream> using namespace std; struct hostel { char name[100]; char address[200]; int roomCharge; int noOfRooms; }; int main() { Hostel hostels[10]; for(int i=0;i<10;i++) { cout<<"\n Enter details for hostel"<<(i+1)<<":"<<endl; cout<<"Name:" cin.ignore(); cin.getline(hostels[i].name,100); cout<<"Address"; cin.getline(hostels[i].address, 200); cout<<"Room Charge:"; cin>>hostels[i].roomCharge; cout<<"No of Rooms:"; cin>>hostels[i].noOfRooms; cout<<endl; } cout<<"Hostels with room charges more than 10000:"<<endl; for(int i=0,i<10,i++) { if(hostels[i].roomCharge>10000) { cout<<"Name:"<<hostels[i].name<<endl; cout<<"Address:"<<hostels[i].address<<endl; cout<<"Room Charger:"<<hostels[i].roomCharge<<endl; cout<<"No of Rooms:"<<hostels[i].noOfRooms<<endl; } } return 0; }
Editor is loading...