Haruno Sakura Posted ديسمبر 16, 2006 Report Share Posted ديسمبر 16, 2006 السلام ياخواني و ياخواتي.. أريد أسأل اذا حد يعرف يحل اسايمنت 8 ... Assignment 8 : Write a program that prompts the user to enter a year and then determines whether it is a leap year. Your program should have a loop and continue while the user enters the character ‘y’. Write three methods according to the following descriptions: _ getYear has no formal parameters, asks the user to enter a year, and returns an integer value that is assigned to the integer variable year. _ isLeap has an integer formal parameter, year, determines whether the year is a leap year, and returns the Boolean value true if the year is a leap year and false if it is not. A year is a leap year if it is divisible by 4, but is not divisible by 100 except when divisible by 400. (The year 2000 was a leap year.) _ moreData has no formal parameters and returns a char value. Sample Output: This program asks you to enter a year in 4 digits. The output shows if the year is a leap year Enter a year: 1492 1492 is a leap year. Do you want to enter more data? y/n y Enter a year: 2000 2000 is a leap year. Do you want to enter more data? y/n y Enter a year: 2005 2005 is not a leap year. Do you want to enter more data? y/n y Enter a year: 1800 1800 is not a leap year. Do you want to enter more data? y/n n Quote Link to comment Share on other sites More sharing options...
صدى الآهات Posted ديسمبر 18, 2006 Report Share Posted ديسمبر 18, 2006 حاولت فيه يطلع لي خمس ارورز صعب الفنكشن شوي شوفو حلي واذا احد عرف له يحطه لنا #include<iostream> using namespace std; int getYear(); bool isleap(int); char moreData(); void main() { char moreData; int Year; cout<<"This program asks you to enter a year in 4 digits."<<endl; cout<<"The output shows if the year is a leap year"<<endl; do { cout<<endl; Year=getYear(); if(isleap(Year)) cout<<Year<<"is a leap year."<<endl<<endl; else cout<<Year<<"is not a leap year."<<endl<<endl; } moreData=moreData(); while (moreData!='n'); } int getYear(); { int y; cout<<"Enter a year:"; cin>>y; return y; } bool isLeap(int x) { if(x%4==0&&x%100!=0||x%400==0) return true else return false } { char m; cout<<"Do you want to enter more data? y/n"; cin>>m; return m; } Quote Link to comment Share on other sites More sharing options...
hams elfjr Posted ديسمبر 18, 2006 Report Share Posted ديسمبر 18, 2006 #include<iostream> using namespace std; int getYear() { int y; cout<<"Enter a year:"; cin>>y; return y; } bool isleap(int x) { if(x%4==0&&x%100!=0||x%400==0) return true; else return false; } char moreData() { char m; cout<<"Do you want to enter more data? y/n "; cin>>m; return m; } void main() { char md1; int Year; cout<<"This program asks you to enter a year in 4 digits."<<endl; cout<<"The output shows if the year is a leap year"<<endl; do { cout<<endl; Year=getYear(); if(isleap(Year)==true) cout<<Year<<"is a leap year."<<endl<<endl; else cout<<Year<<"is not a leap year."<<endl<<endl; md1=moreData(); } while (md1!='n'); } هذي ياجماعه حل الاسايمنت سويته عقب ما طلعت روحي تحياااااااااااااااتي Quote Link to comment Share on other sites More sharing options...
المحروم1610 Posted ديسمبر 18, 2006 Report Share Posted ديسمبر 18, 2006 مشكورة على جهودج ويعطيج الف عافية وننتظر الأسايمنتات اليديده Quote Link to comment Share on other sites More sharing options...
7aira Posted ديسمبر 19, 2006 Report Share Posted ديسمبر 19, 2006 اشكر شعورج الطيب زين سويتي والله .. لانه احنا ماشرحته لنا ولا ادري بشي في اخر الچباتر Quote Link to comment Share on other sites More sharing options...
ماري روز Posted ديسمبر 20, 2006 Report Share Posted ديسمبر 20, 2006 Merci Beacoup students...... Quote Link to comment Share on other sites More sharing options...
hams elfjr Posted ديسمبر 21, 2006 Report Share Posted ديسمبر 21, 2006 حاضريــــــــن للحلويــــــــن Quote Link to comment Share on other sites More sharing options...
~ Pure Heart ~ Posted ديسمبر 27, 2006 Report Share Posted ديسمبر 27, 2006 (edited) يعل روحج سالمة طويلة العمر.. مشكوووووووورة و ما قصرتي .. لقيناه..لقيناه..مفتاح الكنز >>أي كنز أي بطيخ ؟؟ مصخنه !! Edited ديسمبر 27, 2006 by ~ Pure Heart ~ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.