المساعدة - البحث - قائمة الأعضاء - التقويم
نسخة كاملة: [تنبيه]الفزعة الفزعة يا خبراء ++C
برمجة - شبكات - كمبيوتر - منتديات الفريق العربي للبرمجة > منتديات لغات البرمجة العام > منتدى مبرمجي C و ++C و C++.NET > منتدى برمجة ال C++.NET , ولغة البرمجة الجديدة C++/CLI
م. أمل
السلام عليكم ورحمة الله وبركاته


اخواني أخواتي أعضاء هذا المنتدى الرائع ,,

لو سمحتوا بغيت فزعتكم في حل هذين التمرينين اللي لاقيت صعوبة في حلهم ..[/


Exercise 1 (3Points)

Write a program that finds the two largest and two smallest integers in a file that’s filled with numerical values. The input should be read from a file numbers.dat, and the output should be displayed to the screen as well as written to a file named stats.dat. (Hint: before you start, read all you can about EOF-controlled loops in your textbooks)

The format of the input is as follows:

n1 n2 n3 n4 …

The format of the output is as follow:

The file contains ??? numbers
The two largest values in the list are: … …
The two smallest values in the list are: … …


Exercise 2 (3 Points):

A sequence of numbers is monotonic increasing if the values are in sorted order, that is, they are arranged in an increasing order. For example, 1, 1, 3, 4, 9 is a monotonic sequence, but 1, 3, 2, 4, 9 is not a monotonic sequence because 3 is greater than 2.
Write a program that determines whether an input sequence is in monotonic increasing order.




وأرجو أنا لا تبخلو علي بالرد ... جزاكم الله خير ..

أختكم : م. أمل
white soul
السلام عليكم
اول شي انت شغالةعلى السي دوت نت صح ؟ مو السي visula c++ 6
طيب شو رايك تفرجينا كيف بلشتي و بنكمل سوا
لانه من شروط الاجابه انك تفرجينا محاولاتك بالسؤال

سلااام
b.m.s
إقتباس(white soul @ Mar 24 2007, 04:46 PM) [snapback]611876[/snapback]
طيب شو رايك تفرجينا كيف بلشتي و بنكمل سوا
لانه من شروط الاجابه انك تفرجينا محاولاتك بالسؤال

wink_smile.gif
م. أمل
السلام عليكم ورحمة الله وبركاته ..

هــذه هي محاولتي في تمرين 1

#include <iostream>
#include <fstream>
using namespace std;

int main ()
{

int num;
int max=0;
int min=0;


ifstream infile;
ofstream outfile;

infile.open("numbers.dat"); //open the input file
outfile.open("stats.dat"); //open the output file

cout<<"Enter a number";
infile>>num;


while (!infile.eof())

{
if(num>max)
max=num;
else(num<min);
min=num;

infile>>num;
}

cout<<"largest number:";
cout<<max<<endl;

cout<<"smallest number:";
cout<<min<<endl;

// close files
infile.close();
outfile.close();

return 0;
}
م. أمل
أرجو المساعده في الحل بأقرب فرصة جزاكم الله خيرا لأن التسليم سيكون تاريخ 28-3 ..
احمد غريب
العنوان غير مناسب
الرجاء اختيار عنوان مناسب أكثر في مواضيعك القادمة، وهذا بمثابة إشعار للأهمية.
وفي حال التكرار سيتعرض موضوعك للإغلاق والحذف!!!

قواعد المشاركة
http://www.arabteam2000-forum.com/index.php?showtopic=29343
اسم مخالف 20
اعتقد اني جيت بوقت متأخر

سامحوني
هذه "نسخة - خفيفة" من محتويات الرئيسية للإستعراض الكامل مع المزيد من الصور والخيارات الرجاء إضغط هنا.
Invision Power Board © 2001-2009 Invision Power Services, Inc.