| الإهداءات |
|
|||||||
![]() |
|
|
أدوات الموضوع | انواع عرض الموضوع |

|
|
#11 | ||||
|
قوة السمعة: 50
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
السلام عليكم
اختي هنا شرح لمشروع مشابه جدا ً لمشروعك تفضلي هون وراح تستفيدي http://www.velocityreviews.com/forum...file-in-c.html |
||||
|
|||||
| اقتباس المشاركة |
|
|
#12 | |
|
قوة السمعة: 6
![]() |
شكرًا يا أخ محمود
أنا تقريبًا سويت البرنامج ، مع أكيد كتير من المساعدات من النت و الأصدقاء بس هو بس ناقصو شوية أشياء و بيكمل لحتى أسلمه |
|
| اقتباس المشاركة |
|
|
#13 | ||||
|
قوة السمعة: 50
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
اوك شو الي ناقص عندك هلا ؟
وشو الي مش فاهماه فيه ^_^ |
||||
|
|||||
| اقتباس المشاركة |
|
|
#14 | ||||
|
قوة السمعة: 50
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
اسف اختي بس كانت الكهرب قاطعه
شوفي هيك #include<iostream> //for cin,cout #include<fstream> //for file processing functions #include<cctype> //for isalpha(), isdidgit(),....etc. functions using namespace std; void outputNumberOfLines(const char *inputFileName , const char *outputFileName); void outputNumberOfWords(const char *inputFileName , const char *outputFileName); void outputNumberOfLetters(const char *inputFileName , const char *outputFileName); void outputNumberOfDigits(const char *inputFileName , const char *outputFileName); void outputNumberOfPrintableCharacters(c onst char *inputFileName , const char *outputFileName); int getMenuChoice(); char infile[256]; // Input File char outfile[256];// Output File int main() { //Optain desired option from user switch(getMenuChoice()) { case 1: outputNumberOfLines(infile,outfile) ; break; case 2: outputNumberOfWords(infile,outfile) ; break; case 3: outputNumberOfLetters(infile,outfil e); break; case 4: outputNumberOfDigits(infile,outfile ); break; case 5: outputNumberOfPrintableCharacters(i nfile,outfile); break; case 6: /* exit(1); */ break; } cout<<"Result was printed out to "<<outfile<<endl; return 0; } int getMenuChoice() { //Choice to be entered by user int ch; cout<<"\t\tFile Processing"<<endl <<"\t\t==============="<<endl <<endl <<"1- Number of Lines"<<endl <<"2- Number of Words"<<endl <<"3- Number of Lettters"<<endl <<"4- Number of Digits"<<endl <<"5- Number of Printable ASCII Characters"<<endl <<"6- Quit"<<endl; cout<<">"; cin>>ch; cout<<endl; cout<<"You Chose Menu Option #"<<ch<<endl; cout<<"Enter your input file name: ";cin>>infile; cout<<"Enter your output file name: ";cin>>outfile; //Check if user entered invalid choice number if(ch<1 || ch>6) { cout<<"No such option. Please enter a number from the list!"<<endl; return getMenuChoice(); } else return ch; } void outputNumberOfLines(const char *inputFileName , const char *outputFileName) { //opening file for input ifstream inputFile (inputFileName , ios :: in ); //opening file for output ofstream outputFile (outputFileName , ios ::out ); //checking file opening was successful if (! inputFile ) { cerr<<"Error opening file:\t"<<inputFileName<<endl ; exit (1); } if (! outputFile ) { cerr<<"Error opening file:\t"<<outputFileName<<endl ; exit (1); } // a counter variable for no. of lines int count=0; //Loop until end-of-file while(!inputFile.eof()) { char line[1024]; // a line with max length 1024 //This extracts one line a time inputFile.getline(line,1024); count++; } //print count result to output file outputFile<<"Filename: "<<outputFileName<<"\tNumber Of Lines="<<count<<endl; //closing files inputFile . close (); outputFile . close (); } void outputNumberOfWords(const char *inputFileName , const char *outputFileName) { //opening file for input ifstream inputFile (inputFileName , ios :: in ); //opening file for output ofstream outputFile (outputFileName , ios :: out ); //checking file opening was successful if (! inputFile ) { cerr<<"Error opening file:\t"<<inputFileName<<endl ; exit (1); } if (! outputFile ) { cerr<<"Error opening file:\t"<<outputFileName<<endl ; exit (1); } // a counter variable for no. of lines int count=0; //Loop until end-of-file while(!inputFile.eof()) { char line[1024]; // a line with max 1024 //This extracts one word a time inputFile>>line; //don't count single letters if(strlen(line)>1) count++; } //print count result to output file outputFile<<"Filename: "<<outputFileName<<"\tNumber Of Words="<<count<<endl; //closing files inputFile . close (); outputFile . close (); } void outputNumberOfLetters(const char *inputFileName , const char *outputFileName) { //opening file for input ifstream inputFile (inputFileName , ios :: in ); //opening file for output ofstream outputFile (outputFileName , ios :: out ); //checking file opening was successful if (! inputFile ) { cerr<<"Error opening file:\t"<<inputFileName<<endl ; exit (1); } if (! outputFile ) { cerr<<"Error opening file:\t"<<outputFileName<<endl ; exit (1); } // a counter variable for no. of lines int count=0; //Loop until end-of-file while(!inputFile.eof()) { char c; // a line with max 1024 //This extracts one word a time inputFile.get(c); //count only alphabet letters if(isalpha(c)) count++; } //print count result to output file outputFile<<"Filename: "<<outputFileName<<"\tNumber Of Letters="<<count<<endl; //closing files inputFile . close (); outputFile . close (); } void outputNumberOfDigits(const char *inputFileName , const char *outputFileName) { //opening file for input ifstream inputFile (inputFileName , ios :: in ); //opening file for output ofstream outputFile (outputFileName , ios :: out ); //checking file opening was successful if (! inputFile ) { cerr<<"Error opening file:\t"<<inputFileName<<endl ; exit (1); } if (! outputFile ) { cerr<<"Error opening file:\t"<<outputFileName<<endl ; exit (1); } // a counter variable for no. of lines int count=0; //Loop until end-of-file while(!inputFile.eof()) { char c; // a line with max 1024 //This extracts one word a time inputFile.get(c); //count only digits letters if(isdigit(c)) count++; } //print count result to output file outputFile<<"Filename: "<<outputFileName<<"\tNumber Of Digits="<<count<<endl; //closing files inputFile . close (); outputFile . close (); } void outputNumberOfPrintableCharacters(c onst char *inputFileName , const char *outputFileName) { //opening file for input ifstream inputFile (inputFileName , ios :: in ); //opening file for output ofstream outputFile (outputFileName , ios :: out ); //checking file opening was successful if (! inputFile ) { cerr<<"Error opening file:\t"<<inputFileName<<endl ; exit (1); } if (! outputFile ) { cerr<<"Error opening file:\t"<<outputFileName<<endl ; exit (1); } // a counter variable for no. of lines int count=0; //Loop until end-of-file while(!inputFile.eof()) { char c; // a line with max 1024 //This extracts one word a time inputFile.get(c); //count only printable chars if(isprint(c)) count++; } //print count result to output file outputFile<<"Filename: "<<outputFileName<<"\tNumber Of Printable Charachters="<<count<<endl; //closing files inputFile.close (); outputFile.close (); } |
||||
|
|||||
| اقتباس المشاركة |
|
|
#15 | |
|
قوة السمعة: 6
![]() |
يعطيك العافية يا أخ محمود
بس و الله بصراحة الكود لساتو متل ما هو !! و عم يعطيني نفس النتائج اللي أنا عملتها من أول !!!! يعني لسه المشاكل اللي فيه موجود !!! يمكن انت حاولت تضيف Quit للكود ، بس برضو ال program ما بيعمل Quit لما تختار الخيار السادس اللي هو Quit !!!!!!! عالعموم ، اذا ما حد عرف يساعدني مش مشكلة !! الله يعطيكم العافية على كل حال انا بحاول أزبطه مرة تانية ، أو بسأل أي حد تاني يساعدني شكرًا كتير للجميع |
|
| اقتباس المشاركة |
|
|
#16 | ||||
|
قوة السمعة: 50
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
مستحيل اختي ^_^
انا ما حطيت الخروج بس .. بالعكس انا غيرت الشرط //Check if user entered invalid choice number if(ch<1 || ch>6) { cout<<"No such option. Please enter a number from the list!"<<endl; return getMenuChoice(); } else return ch; شوفي هون ^_^ وراح تفهمي لحالك انو الشرط كان محدود لـ 5 انا زودته وخليته لـ 6 حتى يقبلها .. ويدخلها في السويتش ويختار الكييس تاعها الي هوو انو يطلع من البرنامج .. حاولى مرة اخرى وراح يضبط معك للعلم انا ما عندي كمبايلور وياريت تبعتيلي الي عندك حتى اشوفلك اياه .. كل التحية .. |
||||
التعديل الأخير تم بواسطة محمود ; 06-13-2007 الساعة 10:50 AM. |
|||||
| اقتباس المشاركة |
|
|
#17 | |
|
قوة السمعة: 6
![]() |
مرحبا
آسفه على الرد المتأخر !! بس والله مشغولة بامتحاناتي و البحوث و الواجبات اللي ما بتخلص !!! و مش عارفه يا أخ محمود كيف أبعتلك اللي انت طلبتو !!! بس رح أحاول بعدين ان شا الله في ال weekend بس انا متأكده ان الكود اللي انت عدلتلي ياه لسه ما تعدل !! و لسه بيعطيني نفس النتيجة !!! its ok انا ان شاء الله بحكي معك بعدين لأني كتير مشغولة والله مع الســــلامة |
|
| اقتباس المشاركة |
|
|
#18 | ||||
|
قوة السمعة: 50
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
اوكي اختي الكريمة ،،
اضغطي الملف وارفعيه على روسانا www.rooosana.ps وهاتي الرابط الي بطلع معك ، وانا بخدمتكـ ^^ |
||||
|
|||||
| اقتباس المشاركة |
|
|
#19 | |
|
قوة السمعة: 6
![]() |
مرحبا
بصراحة يا أخوي انا مش عارفة انت شو بالضبط بدك ياني أبعت !!! بدك أبعتلك البرنامج اللي بيشغل الكود ، إللي هو Microsoft Visual C++ 6.0 ?!? ولا قصدك أبعتلك ال output تبع الأستاذ اللي لازم نعمل متلو ؟؟؟ عالعموم ، أنا رح أبعتلك كل شي فيك تنزل البرنامج تبع ال C+ من هاد الموقع : http://msdn2.microsoft.com/en-us/vstudio/aa718364.aspxأنا بصراحة نزلت البرنامج من CD كان موجود مع كتاب ال C+ !! و جربت ابعتلك كل شي بيخص ال assignment على الموقع اللي انت قلتللي عليه بس ال output تبع الأستاذ مش راضي ينبعت!! عشان هيك رح أبعث صور منو لحتى تشوف وين المشاكل و الاختلافات اللي في ال output تبعي و ال output تبع الأستاذ هاي الأشياء اللي عملتلها upload في موقع Rooosana : 1) ال handout اللي أعطانا اياها الأستاذ اذا حابب تشوفها http://www.rooosana.ps/Down.php?d=9ugB 2) الكود تبع ال assignment اللي أنا عملتو بعد ما عدلتو و هو بصراحة تعدل الحين كتير عن أول بعد كتير من المساعدات يعني هلأ صار يعمل Quit و يطلع من البرنامج ، و صار يطبع ال results في الoutput .. بس برضو لساتو ناقصو شوية أشياء لحتى يصير تمامًا مطابق لتبع الأستاذ ، اللي هو طبعًا مطلوب منا !! فإنت شوف الكود تبعي و اعملو run ، و رح أبعتلك متل ما قلت الصور من ال output تبع الأستاذ لحتى تشوف انت الفرق !! هاد الكود تبعي http://www.rooosana.ps/Down.php?d=jjpu 3) صور لل output تبع الأستاذ 1- picture of the MAIN MENU http://www.rooosana.ps/Down.php?d=Ivyd 2- After choosing one of the menu selections http://www.rooosana.ps/Down.php?d=FPaQ 3- Entering the name of the output and input files we want to open and read http://www.rooosana.ps/Down.php?d=ASvu 4-Getting the result after reading the files , and then display the menu again http://www.rooosana.ps/Down.php?d=rYM4 5- When choosing a selection not between (1-6) , the menu will be displayed again http://www.rooosana.ps/Down.php?d=jYyU 6-Choosing to Quit from the whole program http://www.rooosana.ps/Down.php?d=Qtx1 |
|
| اقتباس المشاركة |
|
|
#20 | ||||
|
قوة السمعة: 50
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
اوك اختي انا بنزل البرنامج ،،
وبشوفلك اياه ،، لاني انا مبرمج java javascript php C pascal QBasic وبعض اللغات الخفيفة انا قرأت الشروحات على اللغه لقيتها حلوة ^^ بس ما تقلقي البرمجة نفس الفكر يعني راح انزله واشوف المشكلة من وين بالضبط ، على امل انو نصل حل للمشكلة مع اني متأكد انو المشروع تمام (: بس راح اعاينه بنفسي .. |
||||
|
|||||
| اقتباس المشاركة |
![]() |
| الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
|