Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Why doesn't this work fuck you

Name: Anonymousfuckyou 2012-04-21 6:30

#include <iostream>
#include <math.h>
using namespace std;

int checkSize(int palindrome){
int size = 1;
int multiplier = 10;
    while(true){
        if(palindrome/(1*multiplier) == 0){
        return size;
        }
        multiplier*=10;
        size+=1; 
    }
}



bool palindromeCheck(int intArray[], int palindrome){

int size = checkSize(palindrome);
cout<<"SIZE:"<< size<<endl; 

    for(int i = 0; i < size ; i++){
    intArray[i] = (palindrome/pow(10, i)%10;
    cout<<intArray[i]<<endl; 
    }

 for(int x = 0; intArray[x] > intArray[size-x];){
 
 if(intArray[0 + x] != intArray[size - x])
  return 1;
 
  else{x++;}
  }
 
return 0;

}




int main(){

int palindrome;
int numbersize;
bool isPalindrome = false;

    while(true){
    cerr<<"Enter a number to check\n";
    cin>>palindrome;
   
    int palindromeArray[checkSize(palindrome)];

    if(palindromeCheck(palindromeArray, palindrome)){
    cout<<palindrome<<" is a palindrome!\n";}
    else{
    cout<<palindrome<<" is NOT a palindrome.\n";}
    }

}

HINT HINT FAGGOTS: The error is with the POW function. Fuck you

Name: Anonymous 2012-04-21 7:06

oops i forgot to fioc the first two declaractions in the first function definition OOPS

here have the [b][o][/u]slackwa[sub]re[/o][/u][/b] version

#include <iostream>#include <math.h>using namespace std;
int checkSize(int palindrome){int size = 1;int multiplier = 10;
    while(true){if(palindrome/(1*multiplier) == 0){return size;}multiplier*=10;size+=1;}}
bool palindromeCheck(int intArray[], int palindrome){int size = checkSize(palindrome);cout<<"SIZE:"<< size<<endl;
    for(int i = 0; i < size ; i++){intArray[i] = (palindrome/pow(10, i))%10;cout<<intArray[i]<<endl;}                                          
    for(int x = 0; intArray[x] > intArray[size-x];){if(intArray[0 + x] != intArray[size - x]) return 1;else{x++;}}
    return 0;}
int main(){int palindrome;while(true){cerr<<"Enter a number to check\n";cin>>palindrome;
    int palindromeArray[checkSize(palindrome)];
    if(palindromeCheck(palindromeArray, palindrome)){ cout<<palindrome<<" is a palindrome!\n";}
    else{cout<<palindrome<<" is NOT a palindrome.\n";}}}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List