المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : ارجوووكم ساعدوووووووووني ياعباقره



FATI_1
26-05-2004, 11:28 PM
مرحبا

انقذوني يا عباقرة الc++
انا عندي بحث ومو عارفه شسوي علشان اخلصه ومتوهقه:02:

ارجوكم ساعدوني


هذي هي الاسئلة :


Problem:


Design a program that will ask the user to enter six numbers to an array and display the following through a main menu:


a: The numbers enterd


b: The largest and smallest number enterd


c: The sum and avarage of the numbers enterd


d: The histogram of numbers enterd


e: The sorted numbers enterd



Task1 Prepare a program documentation.


This documentation covers the technical design of the given problem.


Design an alogorithm (pseudocode or flowchart) of the given problem. You break the program into pieces by designing a solution on each task. (ex. Solution on how to sort array solution on getting thr largest and smallest numbers enterd)


Task 2 Code the program.


Code the solution using C++ program. Include simple documentation in your code using the COMMENT function of the program. Apply indentations for program readability.


Task 3 Test the program.


Test the program against the given data


-------------------------------------------------------------------------------------------------------------------------------------


Test data:


1:


===========================


Main Menu


1: Input Array


2: Display Array


3: Find Max and Min


4: Find Sum


5: Histogram


6: Sort (Ascending) Array


7: Quit


Enter your choice:


=============================


----------------------------------------------------------------------------


2:


=============================


Input Array


Enter 6 numbers to an array


9


2


4


9


6


7


Press any key to go back to Main Menu!


===============================


---------------------------------------------------------------------------


3:


===============================


Display Array


9 2 4 9 6 7


Press any key to go back to Main Menu!


Press any key to go back to Main Menu!






===============================


------------------------------------------------------------------------------


3:


===============================


Find Max and Min


9 2 4 9 6 7


The largest number is 9


The smllest number is 2


Press any key to go back to Main Menu!



================================


---------------------------------------------------------------------------------------


4:


================================


Find Sum and Average


9 2 4 9 6 7


The sum is 37


The average is 6.17


Press any key to go back to Main Menu!


=================================


-----------------------------------------------------------------------------------------------------


5:


=================================


Histogram


Element Value Graph


0 9 *********


1 2 **


2 4 ****


3 9 *********


4 6 ******


5 7 *******


Press any key to go back to Main Menu!


==================================


-----------------------------------------------------------------------------------------------------


6:


==================================


Sory(Ascending)Array


Data utems in original order:


9 2 4 9 6 7


Data items in ascending order:


2 4 6 7 9 9


Press any key to go back to Main Menu!


===================================


ارجوكم رحم الله والديكم ترى برسب في هالماده :02:

Arsene Lupin
27-05-2004, 03:04 AM
#include <iostream>

using namespace std;

int main()
{
int operation;

cout << "choose operation:" << endl;
cout << "1: Input Array "<< endl;
cout << "2: Display Array"<< endl;
cout << "3: Find Max and Min"<< endl;
cout << "4: Find Sum"<< endl;
cout << "5: Histogram"<< endl;
cout << "6: Sort (Ascending) Array"<< endl;
cout << "7: Quit"<< endl;

cin >> operation;
while (operation != 7)
{
switch (operation)
{
case 1:

break;

case 2:

break;

case 3:

break;

case 4:

break;

case 5:

break;

case 6:

break;

case 7:

break;

default: cout << "Wrong input";
}//end switch
}//end while
}//end main

Arsene Lupin
27-05-2004, 03:10 AM
الكود الي في ردي الاول هو الشكل العام للبرنامج...

الحين خلاص المطلوب عليك تحطين الكود الخاص بكل اختيار في المكان الخاص فيه...

يعني عند case 1 تحطين الكود الي تدخلين الأرقام في ال array... عاد المفروض تحاولين تجربين أشياء بنفسك ولا ما راح تعرفين تحلين في الاختبارات :blackeye:

الحين مستعجل فما كتبت كل البرنامج.. حاولي تكتبين باقي البرنامج... سهل جدا...

و اذا احتجتي نوتات تفيدك في بعض الأوامر في ال C++.. ادخلي هالموقع... مفيد جدا:

هنا (http://www.ittc.ku.edu/~sgauch/168/s01/notes/00.00.html)

اذا احتجتي شي اسألي

سلام

amgadpasha
27-05-2004, 03:33 AM
arsene, as a moderator, is it ok to submit an assignment solutions her on the forum or not??
because a previous post by "E_tooti_E"
http://www.montada.com/showthread.php?t=279706
"amro_ka" which is a moderatour stated that he woun't allow solving assigmnt in the forum..
FATI_1: no offence, i was logging in to post th solution any ways, i really know the stress of the exams time, so i can't preach u, but i was surprised that a moderator replied..
any ways i agree with arsene that u should try to solve the problem ur self and if u need help we can do so, so any ways if u don't have time and it's due soon, tell me and i'll give u th complete solution, if it's ok with arsene

FATI_1
27-05-2004, 06:45 PM
Arsene Lupin (http://www.montada.com/member.php?u=970) مشكووووووووووووور وماتقصر بس انا مافهم شي في الC++ خير شر


الله يهدي اساتذتنا كل استاذ ازود من الثاني :02:
مهو بس انا اشتكي الشكوى لله

ومشكور على الموقع راح احاول اتعلم لوحدي برمجة الc++ شكله مافي الا هذا الحل

amgadpasha (http://www.montada.com/member.php?u=102255) ايه ارجوك اذا ماعليك زحمه تساعدني في الحل وبكون لك شاكره
لأن صرنا على ابواب الامتحانات دوبه الاسايمنت ينجحني في ذي الماده :02: vbmenu_register("postmenu_2653123", true);




وتسلموووون الف شكر لكم

amgadpasha
28-05-2004, 05:34 AM
ok, here u go
ofcourse u have 2 do th documintation parts and these stuff
it's a bit rough :blackeye: and undocumented :06: , but i have an exam next saturday :02: , so i had to make it fast...but it works fine any ways :biggthump , and f u have any questions shoot :jester:

#include <iostream.h>
#include <conio.h>
#include <stdlib.h>

void fin(int*);
void fout(int*);
void fmaxmin(int*);
void fsumavg(int*);
void fhist(int*);
void fsrt(int*);

void main()
{
int arr[6],c;
clrscr();
while(1)
{
cout<<endl<<"\t\t\t\t *main menu*"<<endl<<endl;

cout<<
"1: Input Array"<<endl<<
"2: Display Array"<<endl<<
"3: Find Max and Min"<<endl<<
"4: Find Sum and Average"<<endl<<
"5: Histogram"<<endl<<
"6: Sort (Ascending) Array"<<endl<<
"7: Quit"<<endl<<"Enter your choice:";
cin>>c;
cout<<"================================="<<endl;
switch(c)
{
case 1:
cout<<"Enter 6 numbers to an array"<<endl;
fin(arr);
cout<<endl<<"Press any key to go back to Main Menu!"<<endl;
getch();
break;
case 2:
cout<<"Display Array"<<endl;
fout(arr);
cout<<endl<<"Press any key to go back to Main Menu!"<<endl;
getch();
break;
case 3:
cout<<"Find Max and Min"<<endl;
fmaxmin(arr);
cout<<endl<<"Press any key to go back to Main Menu!"<<endl;
getch();
break;
case 4:
cout<<"Find Sum and Average"<<endl;
fsumavg(arr);
cout<<endl<<"Press any key to go back to Main Menu!"<<endl;
getch();
break;
case 5:
cout<<"Histogram"<<endl;
cout<<"Element Value Graph"<<endl;
fhist(arr);
cout<<endl<<"Press any key to go back to Main Menu!"<<endl;
getch();
break;
case 6:
cout<<"Sort(Ascending)Array"<<endl;
cout<<"Data utems in original order: "<<endl;
fout(arr);
cout<<"Data items in ascending order: "<<endl;
fsrt(arr);
fout(arr);
cout<<endl<<"Press any key to go back to Main Menu!"<<endl;
getch();
break;
case 7:
exit(0);
}
}

}

void fin(int*a)
{
for(int i=0;i<6;i++)
cin>>a[i];
}

void fout(int*a)
{
for(int i=0;i<6;i++)
cout<<a[i]<<" ";
cout<<endl;
}

void fmaxmin(int*a)
{
int mx=a[0],mn=a[0];
fout(a);
for(int i=0;i<6;i++)
{
for(int j=0;j<6;j++)
{
mx=a[j]>a[j+1]?mx>a[j]?mx:a[j]:mx>a[j+1]?mx:a[j+1];
mn=a[j]<a[j+1]?mn<a[j]?mn:a[j]:mn<a[j+1]?mn:a[j+1];
}
}

cout<<"The largest number is "<<mx<<endl;
cout<<"The smllest number is "<<mn<<endl;
}

void fsumavg(int*a)
{
int sm=0;
float av;
fout(a);
for(int i=0;i<6;i++)
sm+=a[i];
av=(float)sm/6;

cout<<"The sum is "<<sm<<endl;
cout<<"The average is "<<av<<endl;
}

void fhist(int*a)
{
for(int i=0;i<6;i++)
{
cout<<i<<" "<<a[i]<<" ";
for(int j=0;j<a[i];j++)
cout<<"*";
cout<<endl;
}
}

void fsrt(int*a)
{
int t;
for(int i=0;i<6;i++)
{
for(int j=0;j<6;j++)
{
if(a[j]>a[j+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
}

}

please ed3eely for my exams
:D :D
:ciao:

FATI_1
28-05-2004, 08:31 AM
ألف الف شكر لك عن جد انقذتني الله يرحم والدينك وياااااااااااااااارب ان شاء الله ناجح بأذن الله في الامتحان

بالتوفييييييق ياااااارب :)

amgadpasha
28-05-2004, 02:37 PM
thanks man :)

Arsene Lupin
29-05-2004, 07:13 AM
amgadpasha:

هلا أخوي... آسف والله أنا مو مراقب على هالقسم فما أدري عن أنظمته بالظبط. لكن المفروض الأعضاء ما يطلبون مثل هالطلبات لأنها فعلا ما راح تفيده مستقبلا..
يعني مثل الأخت الي طلبت هالبرنامج... تقول انها ما تفهم في ال C++ خير شر... يعني مو معقول انها تنجح في الاختبارات!!
المفروض الطلبات تكون مثل كيف أسوي النقطه الفلانيه. مثلا: كيف أقرأ سطر واحد من ملف.
مثل هالأسئلة هي المفروض الي تطرح في هالمنتدى... و ليس برنامج كامل.

عموما مشكور على تعبك اخوي و آسفين على التأخير :tongue2:

و ما أظن انه غلط الواحد يسأل عن حل برنامج كامل... المشكله مشكلته اذا ما لقى أحد يرد عليه. لكن الاخت اليوم صادفها الحظ و لقت من يجاوبها :09:



سلام عليكم و بالتوفيق للجميع

amgadpasha
29-05-2004, 10:12 PM
ok, thanks man