السلام عليكم ..
عندي اسايمنت وجع لي راسي :ah34:
الدكتوره ماشرحته لنا ومطالبين نسلمه بكره الصبح ..
ياريت تساعدوني ..
هاذي محاولتي فيه ..
الســؤال
Three employees in a company are up for a special pay increase. You are given a file named “employee.txt” that contains the following data:
AlSalman Mohamed 5789.000 5
AlAbdulla Ahmad 2798.000 6
AlAhmad Khawlah 1534.000 7
Each input line contains an employee’s last name, first name, current salary and percent increase.
Write a program that reads the data from the specified file and stores the output in the file “employee.dat”. For each employee the data must be in the following order:
First name Last name new salary
Format the data to three decimal places
.
كتبت هالكودات وادري ان الطريقه خطا .. بس حاولت وماعرفت
كود PHP:
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
int main ()
{
ifstream infile ;
ofstream outfile ;
string name ;
float x1 , x2 , x3 ;
infile.open ("employee.txt")
outfile.open("employee.txt")
infile>> x1 , x2 , x3 ;
outfile<<Mohammed << x1 <<" "<< x2 <<" "<< x3 ;
infile>> x1 , x2 , x3 ;
outfile<<Ahmed << x1 <<" "<< x2 <<" "<< x3 ;
infile>> x1 , x2 , x3 ;
outfile<<Khawla << x1 <<" "<< x2 <<" "<< x3 ;
infile.close()
outfile.close()
system("pause");
return 0 ;
}
[LEFT][/LEFT]
المفضلات