سلام عليكم ..
ممكن شرح شلون نطلع الاوت بت حق ال array
مثلا نفس هذا
[/URL][/IMG]![]()
وشكرا مقدما![]()

) خل نفترض ان اول واحد لوب (1) والثاني لوب (2) والثالث لوب(3) ، أول لوب يتم تعيين الـ i كـ صفر ويتم زيادتها في كل مرة بشرط أن تكون أصغر من 3 إذن سوف يتم تنفيذ اللوب ( 1 ) 3 مرات حيث في أول مرة سيكون i = 0 والثانية i = 1 والثالثة i = 2 ...
) يتم الطباعة فيه فقط ويتم تعيين k ك 0 ويتم زيادتها في كل مرة بشرط أن تكون أصغر من 3 إذن سوف يتم تنفيذ اللوب أيضاً 3 مرات ، وسيتم طبع متغير ( رقم ) واحد فقط في كل مرة إذا الآوتبت الكلي سوف يحتوي على 3 أرقام فقط !
char month1[8], month2[8], month3[8];


اعتقد من صياغة السؤال يبي كل الشغلات في ملف واحد ..الناتج يكون مسيف في AVERAGE FILE >>> يعني الـ OUTFILE يصير AVERAGE.TXT

ما فهمت الجزء اللي عن السؤال الثاني
int main()
{
float num[10],sum=0;
ifstream inFile;
inFile.open("demofile.txt");
cout << "Reading information from demofile.txt..." << endl;
for (int i=0;i<5;i++)
inFile >> num[i];
inFile.close();
ofstream outFile;
outFile.open("demofile.txt");
cout << "Enter five numbers, each separated by a space (decimals allowed)" << endl;
for(int i=5;i<10;i++)
cin>>num[i];
for (int i=0;i<10;i++)
{
outFile<<num[i]<<" ";
sum+=num[i];
}
cout<<"The average of all 10 numbers are " << sum/10 << endl;
outFile<<"\nThe average of all 10 numbers are " << sum/10 << endl;
outFile.close();
return 0;
}
for (int i=0;i<5;i++)
؟؟؟؟؟
ما اخذنا هالشي
? can anyone check my solution please
write a program that calculates the average rainfall for three months. The program should ask the user to enter the name of each month, such as June or July, and the amount of rainfall (in millimeters) that fell each month. The program should display a message similar to the following:
The average rainfall for June, July, and August is 6.72 millimeters
* modify the program you wrote , so it reads its input from a file instead of the keyboard
# include <iostream>
#include <iomanip>
using namespace std;
int main()
{
char month1[8], month2[8], month3[8];
double rainfall, avg_Rainfall;
double totalRainfall = 0;
cout << "Enter three consecutive months: " << endl;
cin >> month1 >> month2 >> month3;
cout << "How much inches of rain fell in " << month1 << "?" << endl;
cin >> rainfall;
totalRainfall += rainfall;;
cout << "How much inches of rain fell in " << month2 << "?" << endl;
cin >> rainfall;
totalRainfall += rainfall;
cout << "How much inches of rain fell in " << month3 << "?" << endl;
cin >> rainfall;
totalRainfall += rainfall;
avg_Rainfall = totalRainfall / 3;
system("pause");
return 0;
}
1wirte a program that asks the user to enter 5 floating point numbers . the program should create a file and save all 5 numbers to the file2the program should open the file created in program 1 and ask the user to enter another 5 floating points numbers and save all 5 numbers to the file , calculate the average of all 10 numbers in the file and finally display the average and save the the average file
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
float num1, num2, num3, num4, num5;
cout << "Enter five numbers, each separated by a space (decimals allowed)" << endl;
cin >> num1 >> num2 >> num3 >> num4 >> num5;
ofstream outputFile;
outputFile.open("demofile.txt");
cout << "Now writing those five numbers to demofile.txt file." << endl;
outputFile << num1 << endl;
outputFile << num2 << endl;
outputFile << num3 << endl;
outputFile << num4 << endl;
outputFile << num5 << endl;
outputFile.close();
cout << "Finished writing those five numbers to demofile.txt file." << endl;
return 0;
}
2
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
float num1, num2, num3, num4, num5, sum;
ifstream inFile;
inFile.open("demofile.txt");
cout << "Now reading information from demofile.txt..." << endl;
inFile >> num1;
cout << "num1 is " << num1 << endl;
inFile >> num2;
cout << "num2 is " << num2 << endl;
inFile >> num3;
cout << "num3 is " << num3 << endl;
inFile >> num4;
cout << "num4 is " << num4 << endl;
inFile >> num5;
cout << "num5 is " << num5 << endl;
inFile.close();
cout << "Closed demofile.txt file." << endl;
sum = num1 + num2 + num3 + num4 + num5;
cout << "The sum of these five numbers are " << sum << endl;
return 0;
{
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
string m1 , m2 , m3 ;
float a1 , a2 , a3 , avg ;
cout<< " Enter the all months was sky rain in it : " ;
cin >> m1 >> m2 >> m3 ;
cout << endl ;
cout << " enter the amount of rainfall in each month : " ;
cin >> a1 >> a2 >> a3 ;
cout << endl ;
avg = ( a1 + a2 + a3 ) / 3.0 ;
cout << fixed << showpoint << setprecision(2) ;
cout << " The average rainfall for "<< a1 <<" , " << a2 <<" and " << a3 << " is " << avg << " millimeters " << endl ;
return 0 ;
}

for (int i=0;i<5;i++)
؟؟؟؟؟
ما اخذنا هالشي


int i=0;
while (i<5)
{
i++;
}
كود:
int main()
{
float num[10],sum=0;
ifstream inFile;
inFile.open("demofile.txt");
cout << "Reading information from demofile.txt..." << endl;
for (int i=0;i<5;i++)
inFile >> num;
inFile.close();
ofstream outFile;
outFile.open("demofile.txt");
cout << "Enter five numbers, each separated by a space (decimals allowed)" << endl;
for(int i=5;i<10;i++)
cin>>num;
for (int i=0;i<10;i++)
{
outFile<<num<<" ";
sum+=num;
}
cout<<"The average of all 10 numbers are " << sum/10 << endl;
outFile<<"\nThe average of all 10 numbers are " << sum/10 << endl;
outFile.close();
return 0;
}


شكرا
ما فهمت الجزء اللي عن السؤال الثاني
ما اخذناه للأسف
float num1,num2,num3,num4,num5,num6,num7,num8,num9,num10;
float sum,avg;
ifstream inFile;
inFile.open("demofile.txt");
inFile>>num1>>num2>>num3>>num4>>num5;
cout<<"Please Enter 5 numbers <<endl;
cin>>num6>>num7>>num8>>num9>>num10;
sum=num1+num2+num3+num4+num5+num6+num7+num8+num9+num10;
avg=sum/10;
ofstream outputFile;
outputFile.open("average.txt");
outputFile<<"The average of all 10 numbers are " <<avg<<endl;
cout<<"The average of all 10 numbers are " <<avg<<endl;
inFile.close();
outputFile.close();
return0;
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
float num1,num2,num3,num4,num5,num6,num7,num8,num9,num10;
float sum,avg;
ifstream inFile;
inFile.open("demofile.txt");
inFile>>num1>>num2>>num3>>num4>>num5;
cout<<"Please Enter 5 numbers" <<endl;
cin>>num6>>num7>>num8>>num9>>num10;
sum=num1+num2+num3+num4+num5+num6+num7+num8+num9+num10;
avg=sum/10;
ofstream outputFile;
outputFile.open("average.txt");
outputFile<<"The average of all 10 numbers are " <<avg<<endl;
cout<<"The average of all 10 numbers are " <<avg<<endl;
inFile.close();
outputFile.close();
return0;
}
ماعليكم امر .. ابي شرح حق ال Numbering systems![]()
شرح العضوة "صغيرونة "
ملفين word
https://www.uob-bh.com/upload/do.php?id=16822
و هذي شرح العضوة " Lost Angle "
from any base to DECIMAL :
نستخدم عملية الضرب ،
مثال :
? convert ( 235 )10 to decimal
الحل :
2*10^2 + 3*10^1 + 5*10^0 = 10 (235)
مثال آخر :
? convert (1011)2 to decimal
الحل:
1*2^0 + 1*2^1 + 0*2^2 + 1*2^3 = 10 (11)
:
from DECIMAL to any base :
نستخدم عملية القسمة ،
مثال :
? convert (23)10 to binary
الحل :
23\2 = 11 والباقي 1
11\2 = 5 والباقي 1
5\2 = 2 والباقي 1
2\2 = 1 والباقي 0
1\2 = 0 والباقي 1
إذاً يكون الجواب هو (الباقي) من الأسفل للأعلى
ويُكتب من اليسار لليمين = 10 (10111)
:
from any N to K :
أي للتحويل بينَ أرقام مُختلفة ( أي للهكسادسمل أو غيره .... )
يجب علينا التحويل (from base N to DECIMAL to K)
مثال:
? convert (21)3 to ()5
الحل:
1 ) نقوم بتحويل العدد 3 (21) إلى DECIMAL :
1*3^0 + 2*3^1 = 10(7)
2 ) نقوم بتحويل الناتج من DECIMAL إلى 5() :
7\5 = 1 والباقي 2
1\5 = 0 والباقي 1
الناتج : 5(12)
اذا عندكم اي استفسار او شي مب مفهوم كتبوا اهني و ان شاء الله نساعدكم
