Jump to content
منتدى البحرين اليوم

Recommended Posts

Posted

السلام عليكم ورحمة الله وبركاته،،

اتمنى تساعدوني في حل هالاسايمنت اللي فجر راسي وماعرفت احله :ssm11: ،، وامتبخلون علينا لو تعرفون :n6:

 

 

 

 

Proplem#1

A community hospital needs a program to compute and print a statement for each patient.

Charges for each day are as follows:

1. room charges: private, $125.0; semiprivate, $95.0; ward, $75.0

2. telephone charges: $1.75

3. television charges: $3.50

 

Write a program to get data from the keyboard, and compute the patient’s bill statement.

The program should continue for the next patient until the user enters ‘N’ [Hint: Use do-while loop for the no: of patients]. The sample output is given below:

 

Enter the No: of Days: 5

Type of room Used: p

Telephone Used: N

Television Used: Y

Community hospital

*****************

 

Patient billing

Number of days in hospital: 5

Type of room: P

Room charge: $625.00

Telephone charge: $0.00

Television charge $17.50

Patient: 1

 

 

 

 

Total due $642.50

Do you want to continue: Y

Enter the no: of days: 1

Type of room used: w

Telephone used: N

Television used: N

Community hospital

*****************

 

 

 

 

 

 

 

 

Patient billing

Number of days 1

Type of room W

Room charge $0.0

Phone charge $0.0

TV charge $0.0

 

Total Due $75.0

Do you want to continue: N

Patient 2

 

 

 

 

Proplem#2

A perfect number is positive number such that the sum of the proper divisors equals the number. Thus, 28=1+2+4+7+14 is perfect number. If the sum of the divisors is less than the number, it is deficient, if sum exceeds the number, it is abundant, and otherwise it is perfect number. [hint: use any loop starting from 1 to the entered value. Use if- condition for checking the divisors].

 

 

 

 

Posted

سوري..

النت مقطوع بالبيت..

آنا حليت الحين بالجامعة..

 

تمرين الاول

الثاني بعد شوي راح احول فيه..

 

#include<iostream.h>

int main();

{

float x,z,c,v,b,a,k,h,v;

 

 

do

 

{

cout<<"Enter the No: of Days:\nType of room Used:\nTelephone Used:\nTelevision Used:\nCommunity hospital\n*****************";

cin>>z>>x>>c>>v;

 

if (x==p)

{

x=125.0;

}

else if (x==s)

{

x=95.0;

}

 

else

{

 

x=75.0;

}

 

a=z*x;

 

 

 

if (c==y)

{

c=1.75;

}

else

{

return 0;

}

 

b=z*c;

 

if (v==y)

{

v=3.50;

}

else

{

return 0;

}

 

f=z*v;

h=a+b+f;

 

cout<<"Patient billing\nNumber of days in hospital:"<<z<<"\nType of room:"<<x<<"\nRoom charge:"<<a<<"\nTelephone charge:"<<b<<"\nTelevision charge"<<f<<"\nTotal Due"<<h;

 

cout<<"Do you want to continue"

cin>>k;

 

}

while (k=='y')

 

 

return 0;

 

}

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
الرد على هذا الموضوع...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...