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

مشاهدة النسخة كاملة : اللي يعرف للغة الـ++c والله ضروري جدا جدا :(



turkishcoffee
30-10-2008, 12:19 PM
السلام عليكم ..
كيفكم ان شاء الله تمام ..
هادي اول مشاركة ليا في المنتدى :)
والله طالبة مساعدتكم بشدة وان شاء الله تقدرو تفيدوني ..


عندي exercise اللي هوا كالتالي :
write a c++ programe to do the following :
1-
ask the user to enter his address(street name and bulding number)
2-
write the address into a file named "UserData.txt" .. then
3-
ask the user to enter any letter ,, then write a function that reads the file "UserData.txt" and counts how many times that letter appears in it.
4-
display the total count of letter apperance


انا حطيت في الملفات المرفقة اللي قدرت اكتبو من البرنامج ..
لكن وصلت الين الـ function ووقفت ما عرفت اعملها :frown:


الله يخليكم يا ريت اللي يقدر يساعدني ما يبخل عليا بلييييز :ee2:


اختكم
sweety-turkish

turkishcoffee
31-10-2008, 08:30 AM
صباح الخير ع الجميع :)
:02::02:
عدد الزوار 16 بس مافي ولا رد :02:
الله يخليكم اللي يقدر يساعدني لا يبخل عليا

AZPC
31-10-2008, 09:24 AM
السلام عليكم ,,

همممم .. لي رجعه ان شاء الله ..

بس لو تدوري في جووجل عن كيفية عمل الدوال في سي++ اكيد بتحصلين

بالتوفيق

turkishcoffee
01-11-2008, 12:58 AM
:02::cray::umm2:

AZPC
01-11-2008, 06:55 PM
اوكي اختي /

عندج مشكله بسيطه تنحل ان شاء الله


احم

عدلت الكود --------- بس ما جربته ولا سويت له compile :09:

فـ اكيد بيكون فيه اغلاط -- حاولي تصلحينه بروحج :silly:

يلا بالتوفيق ،،


#include<iostream.h>
#include<fstream.h>

void readcount(); ///////////////////// declaration of the function
main()
{

char ch[30];

cout<<"enter your address please: \n";
cin>>ch;


ofstream f;
f.open("UsedData.txt",ios::out);
f<<ch<<endl;
cout<<endl;
f.close();


readcount(); //////////////////////////// call 4 the function
cout<<endl;
return 0;
}


/////////// function definition //////////////

void readcount()
{
char ch[2000];
char c;
int coutner = 0;
cout<<"enter a letter please";
cin>>c;
ifstream fin;
fin.open("UserData.txt",ios::in);
cout<<endl;
while (!fin.eof())
{
file_op.getline(str,2000);
}
fin.close();
// now do a loop to count letters in the file.
for(int i = 1; i<= 2000; i++) //try to replace 2000 with the actual size of the array..! (I didnt serach for it ;P sry ;*
{
if (str[i] == c) counter++;
}
cout<<"You have enterd the letter: "<<c<<" This times: "<<counter;

\\\\\\ hope I helped you ^__^
}




- - دعواتج :ponder: - -

turkishcoffee
02-11-2008, 01:14 AM
ثاااااااااانكس azpc :ee2:.. اللهي يسعدك يا رب :)
حاجرب الكود وحأرجع احكيك ان شاء الله .. يعطيك العافية
thanks again :ee2:

AZPC
02-11-2008, 07:44 AM
welcome sis .. آمين يا رب ...

اكتشفت غلطه بسيطه/

for(int i = 1; i<= 2000; i++) //try to replace 2000 with the actual size of the array..! (I didnt serach for it ;P sry ;*
{
if (str[i] == c) counter++;
}

المفروض تكون



for(int i = 1; i<= 2000; i++) //try to replace 2000 with the actual size of the array..! (I didnt serach for it ;P sry ;*
{
if (ch[i] == c) counter++;
}