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

رجعت لكم . بأسيمنتاتي .. اسايمنت5


Recommended Posts

 

 

 

السلاااااااااااااااام

 

قوة ياشعب

 

شخباركم مع التستات انشالله توفقتو

 

المهم .. يعني لو ما آنه انزل طلب اني ابي حل الاسايمنت محد اينزله؟؟ :ssm11:

 

أدري بتقولون ان هاذي ماتحل وتبي على طول بارز لا إلا أحل بس ماعرف ارتبه عدل اعرف الفكرة بس ماعرف اصفه عدل ..

 

:n10: على الاقل انه جريئة احطه وافيد اللي يبونه بعد ابحلولكم

 

ومشكورين مقدما

 

واذا تبون اكتب السؤال باكتبه .. بس لان اهو وايد طويل من جذي ماكتبته..

 

 

 

تحيااااااااااتي

 

 

Link to comment
Share on other sites

 

مشكورين حبايبي على مروركم

 

وهاي السؤال

 

 

Write a program that simulates an order room of a factory. To fill an order, workers place items on a conveyer belt to be grouped, billed, and shipped. Each item has a UPC code that designates the name of the item and its price. When an order is complete, a worker places a bar on the conveyor belt to separate the order from the next order. The bar has a UPC code of 999 is a sentinel value.

After the computer system scans the UPC code of each item, it records the name and price in a file named invoice1.txt. This output file contains the product name and price on one line, separated by a pound sign (#). For example, if hammer were purchased for the price of 9.95, the program writes this line as hammer#9.95. the program does not write the sentinel value to the output file. In your program, use while repetition construct. Because this is a program simulation, prompt the user to enter the name and price of each item. On a real order-scanning machine, no prompt would be used. When the system reads the value 999, display a thank you message, the name of the output file, and each item and price added to the output file.

 

 

The input entered by the user is:

 

 

Please scan the name of the first item: hammer

Please scan the price of the hammer: 9.95

 

Please scan the name of the next item: saw

Please scan the price of the saw: 20.15

 

 

Please scan the name of the next item: shovel

Please scan the price of the shovel: 35.40

 

 

Please scan the name of the next item: 999

 

Thank you for your order.

Invoicel1 . txt

Hammer#9.95

Saw#20.15

Shovel#35.40

 

ومشكورين مقدما ويعطيكم العافية

 

تحيااااااااااااتي

 

شايمة

Link to comment
Share on other sites

هذي هو الحل خيتو :n10:

 

 

#include<iostream>

#include<fstream>

#include<string>

#include<iomanip>

using namespace std;

void main()

{

string name;

double price;

int count=0;

 

ofstream outfile;

outfile.open("invoicel2.txt");

outfile<<"Thank you for your order."<<endl;

outfile<<"invoicel.txt"<<endl;

name="0";

cout<<"Please scan the name of the first item: ";

cin>>name;

while(name!="999")

{

 

count++;

outfile<<name<<'#';

cout<<"Please scan the price of the "<<name<<" "<<":";

cin>>price;

outfile<<price<<endl;

 

cout<<"\nPlease scan the name of the next item: ";

cin>>name;

 

 

}

 

outfile.close();

 

 

ifstream infile;

infile.open("invoicel2.txt");

infile.ignore(50,'\n');

infile.ignore(50,'\n');

cout<<"Thank you for your order."<<endl;

cout<<"invoicel.txt"<<endl;

infile>>name;

while(count>0)

{

count--;

cout<<name<<endl;

infile>>name;

}

 

infile.close();

 

 

 

}

Link to comment
Share on other sites

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...