1 مرفق
اللي يعرف للغة الـ++c والله ضروري جدا جدا :(
السلام عليكم ..
كيفكم ان شاء الله تمام ..
هادي اول مشاركة ليا في المنتدى :)
والله طالبة مساعدتكم بشدة وان شاء الله تقدرو تفيدوني ..
عندي 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
رد: اللي يعرف للغة الـ++c والله ضروري جدا جدا :(
صباح الخير ع الجميع :)
:02::02:
عدد الزوار 16 بس مافي ولا رد :02:
الله يخليكم اللي يقدر يساعدني لا يبخل عليا
رد: اللي يعرف للغة الـ++c والله ضروري جدا جدا :(
السلام عليكم ,,
همممم .. لي رجعه ان شاء الله ..
بس لو تدوري في جووجل عن كيفية عمل الدوال في سي++ اكيد بتحصلين
بالتوفيق
رد: اللي يعرف للغة الـ++c والله ضروري جدا جدا :(
رد: اللي يعرف للغة الـ++c والله ضروري جدا جدا :(
اوكي اختي /
عندج مشكله بسيطه تنحل ان شاء الله
احم
عدلت الكود --------- بس ما جربته ولا سويت له compile :09:
فـ اكيد بيكون فيه اغلاط -- حاولي تصلحينه بروحج :silly:
يلا بالتوفيق ،،
كود PHP:
#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: - -
رد: اللي يعرف للغة الـ++c والله ضروري جدا جدا :(
ثاااااااااانكس azpc :ee2:.. اللهي يسعدك يا رب :)
حاجرب الكود وحأرجع احكيك ان شاء الله .. يعطيك العافية
thanks again :ee2:
رد: اللي يعرف للغة الـ++c والله ضروري جدا جدا :(
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++;
}