مرام الحلوة
24-07-2007, 08:14 PM
هلا شباب وصبايا ..
ممكن سؤال الاقي حله عندكم .. بليييز ساعدوني
write a c++ program that reads four(4) double numbers from an input file named "input.dat", and write the numbers in reverse order to output file named "output.dat" each in separate line and in the format shown below.
sample of the input and output files.
input.dat:
31.67 41.539 59.274 61.98768
output.dat:
###61.9877
$$$$$59.27
$$$$$41.54
###31.6700
بلييييز ساعدوني فيه
مرام الحلوة
24-07-2007, 08:25 PM
وبليييز مساعدة في هذا البرنامح ايضا...
writ aprogram that calculates the circumference or the ares of circle. the program should read from indata.txt file radius and a character to determine the calculated value.
'C' means calculate the circumference and 'A' means calculate the area. where,
area=3.14*radius*radius and circumference = 2*3.14*radius.
the programe should writ the output into outdata.txt file twice with two different formatting. use formatting function you learn in the lecture.
suppose the inData file contain:
A 6.5
the outData file will cointain:
6.50
منطلق بطموحي
24-07-2007, 11:18 PM
السلام عليكم:
الفكرة نفسها هي فكرة بسيطة بالنسبة للسؤالين ...كل الموضوع هو ال streams التعامل مع الملفات
ارينا محاولاتك كي نساعدك للوصول للحل
مرام الحلوة
26-07-2007, 02:29 AM
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main ()
**
double x=61.9868;
double y=59.274;
double z=41.539;
double r=31.67;
ifstream infile;
ofstream outfile;
infile.open("input.dat");
outfile.open("output.dat");
cout << fixed <<showpoint;
cout << setprecision(4);
cout << left;
cout<<"enter four double number"<<endl;
cin>>x>>y>>z>>r;
cout<<setw(5)<<x<<setw(7)<<y<<setw(7)<<z<<setw(5)<<r;
cout<<setw(5)<<r<<setfill('#')<<endl;
cout<<setw(7)<<y<<setfill('$')<<endl;
cout<<setw(7)<<z<<setfill('$')<<endl;
cout<<setw(5)<<x<<setfill('#')<<endl;
cout<<setw(5)<<r<<setfill('#')<<setw(7)<<y<<setfill('$')
<<setw(7)<<z<<setfill('$')<<setw(5)<<x<<setfill('#')<<endl;
infile.close();
outfile.close();
return 0;
}
هذا حلي وابي رد بسرعة بليييز .. اذا خطأ بلييز ابي الحل !!!