Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- /*
- bool isAlpha(char c)
- {
- return ((c>='A' && c<='Z') || (c>='a' && c<='z'));
- }
- bool isAllAlpha(char arr[])
- {
- bool flag = true;
- int size = len(arr);
- for(i = 0; i<len(arr); i++)
- {
- if(!isAllAlpha(arr[i]))
- {
- return false;
- }
- }
- }
- */
- /*
- bool isNumber(char *niz)
- {
- for (int i = 0; i<len(niz); i++)
- {
- if('0' > niz[i] || niz[i] > '9')
- {
- return false;
- }
- }
- return true;
- }
- int toNumber (char *niz)
- {
- if (isNumber(niz))
- {
- int number = 0;
- for(int i = 0; i<len(niz); i++)
- {
- number *= 10;
- number += (int)niz[i] - '0';
- }
- return number;
- }
- return -1;
- }
- */
- int countMatches(int x, int k)
- {
- if(x%10 == k)
- {
- return 1 + countMatches(x/10, k)
- }
- if (abs(x)<=9)
- {
- if(x == 0)
- {
- return 0;
- }
- return countMatches(x/10, k);
- }
- }
- void printHelper(int k, int n)
- {
- if(k == n)
- {
- cout<<n<<endl;
- }
- else
- {
- printHelper(k+1, n);
- for(int i = 1; i>= k; i--)
- {
- cout<<i<<" ";
- }
- cout<<endl;
- }
- }
- int comp(char a[], char b[], int index)
- {
- if (a[index] == '\0')
- {
- if(b[index] == '\0'){
- return 0;
- }
- return -1;
- }
- if (b[index] == '\0')
- {
- return 1;
- }
- if (a[index] < b[index])
- {
- return -1;
- }
- if(a[index == b[index]){
- return comp(a, b, ++index);
- }
- if(a[index] > b[index]){
- return -1;
- }
- }
- int main()
- {
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment