P PHC-Eye Eternal Poster Joined Jun 6, 2020 Posts 589 Reaction 159 Points 274 Dec 6, 2021 #1 Attachments You do not have permission to view the full content of this post. Log in or register now.
F FoXOnE23 Honorary Poster Dec 6, 2021 #2 C++: #include <iostream> using namespace std; int main() { int arr[10]={}; bool isEven = false; bool isOdd = false; cout<<"Input 10 integers in array :"<<endl; for(int i=1; i<=10; i++) { cout<<"array["<<i<<"]: "; cin>>arr[i]; if(arr[i]%2 == 0) { isEven = true; } else { isOdd = true; } } cout<<endl<<endl; if(isEven){ cout<<"Even integers Found!"<<endl; cout<<"The Even integers are: "<<endl; } else{ cout<<"No Even integers Found!"<<endl<<endl; } for(int i=1; i<=10; i++) { if(arr[i]%2 == 0) { cout<<arr[i]<<" "; } } cout<<endl<<endl; if(isOdd){ cout<<"Odd integers Found!"<<endl; cout<<"The Odd integers are: "<<endl; } else{ cout<<"No Odd integers Found!"<<endl<<endl; } for(int i=1; i<=10; i++) { if(arr[i]%2 == 1) { cout<<arr[i]<<" "; } } return 0; }
C++: #include <iostream> using namespace std; int main() { int arr[10]={}; bool isEven = false; bool isOdd = false; cout<<"Input 10 integers in array :"<<endl; for(int i=1; i<=10; i++) { cout<<"array["<<i<<"]: "; cin>>arr[i]; if(arr[i]%2 == 0) { isEven = true; } else { isOdd = true; } } cout<<endl<<endl; if(isEven){ cout<<"Even integers Found!"<<endl; cout<<"The Even integers are: "<<endl; } else{ cout<<"No Even integers Found!"<<endl<<endl; } for(int i=1; i<=10; i++) { if(arr[i]%2 == 0) { cout<<arr[i]<<" "; } } cout<<endl<<endl; if(isOdd){ cout<<"Odd integers Found!"<<endl; cout<<"The Odd integers are: "<<endl; } else{ cout<<"No Odd integers Found!"<<endl<<endl; } for(int i=1; i<=10; i++) { if(arr[i]%2 == 1) { cout<<arr[i]<<" "; } } return 0; }
P PHC-Eye Eternal Poster Dec 7, 2021 TS TS #3 FoXOnE23 said: C++: #include <iostream> using namespace std; int main() { int arr[10]={}; bool isEven = false; bool isOdd = false; cout<<"Input 10 integers in array :"<<endl; for(int i=1; i<=10; i++) { cout<<"array["<<i<<"]: "; cin>>arr[i]; if(arr[i]%2 == 0) { isEven = true; } else { isOdd = true; } } cout<<endl<<endl; if(isEven){ cout<<"Even integers Found!"<<endl; cout<<"The Even integers are: "<<endl; } else{ cout<<"No Even integers Found!"<<endl<<endl; } for(int i=1; i<=10; i++) { if(arr[i]%2 == 0) { cout<<arr[i]<<" "; } } cout<<endl<<endl; if(isOdd){ cout<<"Odd integers Found!"<<endl; cout<<"The Odd integers are: "<<endl; } else{ cout<<"No Odd integers Found!"<<endl<<endl; } for(int i=1; i<=10; i++) { if(arr[i]%2 == 1) { cout<<arr[i]<<" "; } } return 0; } Click to expand... wala po ba yung hindi gumagamit ng bool?
FoXOnE23 said: C++: #include <iostream> using namespace std; int main() { int arr[10]={}; bool isEven = false; bool isOdd = false; cout<<"Input 10 integers in array :"<<endl; for(int i=1; i<=10; i++) { cout<<"array["<<i<<"]: "; cin>>arr[i]; if(arr[i]%2 == 0) { isEven = true; } else { isOdd = true; } } cout<<endl<<endl; if(isEven){ cout<<"Even integers Found!"<<endl; cout<<"The Even integers are: "<<endl; } else{ cout<<"No Even integers Found!"<<endl<<endl; } for(int i=1; i<=10; i++) { if(arr[i]%2 == 0) { cout<<arr[i]<<" "; } } cout<<endl<<endl; if(isOdd){ cout<<"Odd integers Found!"<<endl; cout<<"The Odd integers are: "<<endl; } else{ cout<<"No Odd integers Found!"<<endl<<endl; } for(int i=1; i<=10; i++) { if(arr[i]%2 == 1) { cout<<arr[i]<<" "; } } return 0; } Click to expand... wala po ba yung hindi gumagamit ng bool?
F FoXOnE23 Honorary Poster Dec 7, 2021 #4 saoamander86 said: wala po ba yung hindi gumagamit ng bool? Click to expand... pwede po naman
P PHC-Eye Eternal Poster Dec 7, 2021 TS TS #5 FoXOnE23 said: pwede po naman Click to expand... how po hahaha sorry po still beginner lang po
F FoXOnE23 Honorary Poster Dec 7, 2021 #6 C++: #include <iostream> using namespace std; int main() { int arr[10]={}; string a = ""; string b = ""; cout<<"Input 10 integers in array :"<<endl; for(int i=1; i<=10; i++) { cout<<"array["<<i<<"]: "; cin>>arr[i]; } cout<<endl<<endl; for(int i=1; i<=10; i++) { if(arr[i]%2==0) { a = "Even integers Found!"; } else { b = "Odd integers Found"; } } if(a.empty()) { cout<<"No Even integers Found!"<<endl<<endl; if(b.empty()) { cout<<"No Odd integers Found!"<<endl<<endl; } else { cout<<b<<endl; cout<<"The Odd integers are: "<<endl; for(int i=1; i<=10; i++) { if(arr[i]%2==1) { cout<<arr[i]<<" "; } } } } else { cout<<a<<endl; cout<<"The Even integers are: "<<endl; for(int i=1; i<=10; i++) { if(arr[i]%2==0) { cout<<arr[i]<<" "; } } cout<<endl<<endl; if(b.empty()) { cout<<"No Odd integers Found!"<<endl<<endl; } else { cout<<b<<endl; cout<<"The Odd integers are: "<<endl; for(int i=1; i<=10; i++) { if(arr[i]%2==1) { cout<<arr[i]<<" "; } } } } cout<<endl<<endl; return 0; } C++: #include <iostream> using namespace std; int main(){ int arr[10]={}; cout<<"Input 10 integers in array: "<<endl; for(int i=1; i<=10; i++){ cout<<"arr["<<i<<"]: "; cin>>arr[i]; } cout<<endl; for(int i=1; i<=10; i++){ if(arr[i]%2==0){ for(int j=1; j<=10; j++){ if(arr[j]%2==1){ goto both; } } } } for(int i=1; i<=10; i++){ if(arr[i]%2==0){ for(int j=1; j<=10; j++){ if(arr[j]%2==0){ goto even; } } } } for(int i=1; i<=10; i++){ if(arr[i]%2==1){ for(int j=1; j<=10; j++){ if(arr[j]%2==1){ goto odd; } } } } even: cout<<"Even integers Found!"<<endl; cout<<"The Even integers are: "<<endl; for(int i=1; i<=10; i++){ if(arr[i]%2==0) cout<<arr[i]<<" "; } cout<<endl<<endl; cout<<"No Odd integers Found!"; goto exit; odd: cout<<"No Even integers Found!"<<endl; cout<<endl; cout<<"Odd integers Found!"<<endl; cout<<"The integers are: "<<endl; for(int i=1; i<=10; i++){ if(arr[i]%2==1) cout<<arr[i]<<" "; } goto exit; both: cout<<"Even integers Found!"<<endl; cout<<"The Even integers are: "<<endl; for(int i=1; i<=10; i++){ if(arr[i]%2==0) cout<<arr[i]<<" "; } cout<<endl<<endl; cout<<"Odd integers Found!"<<endl; cout<<"The Odd integers are: "<<endl; for(int i=1; i<=10; i++){ if(arr[i]%2==1) cout<<arr[i]<<" "; } exit: return 0; } Last edited: Dec 7, 2021
C++: #include <iostream> using namespace std; int main() { int arr[10]={}; string a = ""; string b = ""; cout<<"Input 10 integers in array :"<<endl; for(int i=1; i<=10; i++) { cout<<"array["<<i<<"]: "; cin>>arr[i]; } cout<<endl<<endl; for(int i=1; i<=10; i++) { if(arr[i]%2==0) { a = "Even integers Found!"; } else { b = "Odd integers Found"; } } if(a.empty()) { cout<<"No Even integers Found!"<<endl<<endl; if(b.empty()) { cout<<"No Odd integers Found!"<<endl<<endl; } else { cout<<b<<endl; cout<<"The Odd integers are: "<<endl; for(int i=1; i<=10; i++) { if(arr[i]%2==1) { cout<<arr[i]<<" "; } } } } else { cout<<a<<endl; cout<<"The Even integers are: "<<endl; for(int i=1; i<=10; i++) { if(arr[i]%2==0) { cout<<arr[i]<<" "; } } cout<<endl<<endl; if(b.empty()) { cout<<"No Odd integers Found!"<<endl<<endl; } else { cout<<b<<endl; cout<<"The Odd integers are: "<<endl; for(int i=1; i<=10; i++) { if(arr[i]%2==1) { cout<<arr[i]<<" "; } } } } cout<<endl<<endl; return 0; } C++: #include <iostream> using namespace std; int main(){ int arr[10]={}; cout<<"Input 10 integers in array: "<<endl; for(int i=1; i<=10; i++){ cout<<"arr["<<i<<"]: "; cin>>arr[i]; } cout<<endl; for(int i=1; i<=10; i++){ if(arr[i]%2==0){ for(int j=1; j<=10; j++){ if(arr[j]%2==1){ goto both; } } } } for(int i=1; i<=10; i++){ if(arr[i]%2==0){ for(int j=1; j<=10; j++){ if(arr[j]%2==0){ goto even; } } } } for(int i=1; i<=10; i++){ if(arr[i]%2==1){ for(int j=1; j<=10; j++){ if(arr[j]%2==1){ goto odd; } } } } even: cout<<"Even integers Found!"<<endl; cout<<"The Even integers are: "<<endl; for(int i=1; i<=10; i++){ if(arr[i]%2==0) cout<<arr[i]<<" "; } cout<<endl<<endl; cout<<"No Odd integers Found!"; goto exit; odd: cout<<"No Even integers Found!"<<endl; cout<<endl; cout<<"Odd integers Found!"<<endl; cout<<"The integers are: "<<endl; for(int i=1; i<=10; i++){ if(arr[i]%2==1) cout<<arr[i]<<" "; } goto exit; both: cout<<"Even integers Found!"<<endl; cout<<"The Even integers are: "<<endl; for(int i=1; i<=10; i++){ if(arr[i]%2==0) cout<<arr[i]<<" "; } cout<<endl<<endl; cout<<"Odd integers Found!"<<endl; cout<<"The Odd integers are: "<<endl; for(int i=1; i<=10; i++){ if(arr[i]%2==1) cout<<arr[i]<<" "; } exit: return 0; }