๐
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int reverseDigit (int num){ | |
| int reversedNumber = 0; | |
| while (num > 0){ | |
| int d = num % 10; | |
| reversedNumber = reversedNumber * 10 + d; | |
| num /= 10; | |
| } | |
| return reversedNumber; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // www.abukhleif.com | |
| int reverseDigit (int num){ | |
| bool isNegative = false; | |
| if (num < 0){ | |
| isNegative = true; | |
| num = -1 * num; | |
| } | |
| int reversedNumber = 0; | |
| while (num > 0){ | |
| int d = num % 10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // www.abukhleif.com | |
| #include <iostream> | |
| using namespace std; | |
| int reverseDigit (int num){ | |
| bool isNegative = false; | |
| if (num < 0){ | |
| isNegative = true; | |
| num = -1 * num; | |
| } | |
| int reversedNumber = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // www.abukhleif.com | |
| #include <iostream> | |
| using namespace std; | |
| void EvenOdd (int num, int& evens, int& odds) { | |
| evens = odds = 0; | |
| while (num != 0) { | |
| if (num % 2 == 0) | |
| evens++; | |
| else | |
| odds++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // www.abukhleif.com | |
| void EvenOdd (int num, int& evens, int& odds) { | |
| evens = odds = 0; | |
| while (num != 0) { | |
| if (num % 2 == 0) | |
| evens++; | |
| else | |
| odds++; | |
| num /= 10; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // www.abukhleif.com | |
| class ArrayStack { | |
| private final int[] stack; | |
| private final int size; | |
| private int top; | |
| public ArrayStack(int size) { | |
| this.size = size; | |
| stack = new int[size]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // www.abukhleif.com | |
| class ArrayQueue { | |
| private final int[] queue; | |
| private int first = 0; | |
| private int last = 0; | |
| int size = 0; | |
| public ArrayQueue(int size) { | |
| queue = new int[size]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // www.abukhleif.com | |
| bool isVowel (char x) { | |
| char y = toupper(x); | |
| return (y=='A' || y=='E' || y=='I'|| y=='O'|| y=='U'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // www.abukhleif.com | |
| bool isVowel (char x) { | |
| return (x == 'A' || x == 'a' || | |
| x == 'E' || x == 'e' || | |
| x == 'I' || x == 'i' || | |
| x == 'O' || x == 'o' || | |
| x == 'U' || x == 'u'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // www.abukhleif.com | |
| #include <iostream> | |
| using namespace std; | |
| bool isVowel (char x) { | |
| char y = toupper(x); | |
| return (y=='A' || y=='E' || y=='I'|| y=='O'|| y=='U'); | |
| } | |
| int main() { | |
| cout<< isVowel('a'); | |
| return 0; |
OlderNewer