"I would buy every Shins album ever made if it made me one iota as cute as Natalie Portman was in that movie." -Kasey, m'roommate. People who act cute just so people will think they are cute drive me absolutely insane. Mostly because I used to do that, and in a way I still do, just not as much/blatantly. This is one of the reasons I didn't enjoy Garden State. The director made Natalie Portman be so perfectly cute it was disgusting. The movie did have a lot of really good quotes though, which is why I've cycled through so many GS icons.
Workin' on the site. I wish I could find the html for my old school Pris layout because I wanna use it again and I still have all the pictures.
New eljay icon, it's me! I need to learn to take pictures of myself not in mirrors. Or at least turn the damn flash off. I like shiny things though.
Last week wasn't very fun. I had a test in every class but CS. My ochem prof is a real prick. I think I would do a lot better in that class if I didn't hate him so. But I did manage to finish my palindrome program, which would have been a lot easier if we *hadn't* had to use pointers. I know most of you aren't going to be able to tell what's going on, and that makes me feel like I've actually learned something over the past semester.
// File name: 01Palindromedick2879.cpp
// Author: Nicole Dickison
// Date: 02/14/05
// Class: CS 250
// Assignment: Palindrome Checker
// Professor: Shereen Khoja
// Purpose: Determines which lines in a file contain palindromes.
// Input: The file to be read
// Output: The file with palindromes, without palindromes, and the number of each
#include "stdafx.h"
#include
#include
#include
#include
using namespace std;
ifstream inputFile;
ofstream palinFile, nonPalinFile;
void openFiles( ifstream&, ofstream&, ofstream& );
bool isLength(char[]);
bool isPalin(char[], int);
void putPalindrome(char[]);
void notPalindrome(char[]);
void numbers(int, int);
int main()
{
int numPal = 0, numNot = 0;
const int SIZE = 200;
char line[SIZE];
openFiles( inputFile, palinFile, nonPalinFile );
while(inputFile.getline( line, SIZE))
{
if(isLength(line))
{
putPalindrome(line);
numPal++;
}
else
{
notPalindrome(line);
numNot++;
}
}
numbers(numPal, numNot);
return 0;
}
void openFiles( ifstream& inputFile, ofstream& palinFile, ofstream& nonPalinFile )
{
inputFile.open( "palindromes.txt", ios::in );
palinFile.open( "palindrome.txt", ios::out );
nonPalinFile.open( "nonpalindrome.txt", ios::out);
if( !inputFile || !palinFile || !nonPalinFile )
{
cout << "Error opening files";
exit( 1 );
}
}
bool isLength ( char line[] )
{
int length = strlen(line);
return (isPalin(line, length));
}
bool isPalin ( char line[], int length )
{
char *left = line;
char *right = (line + length) -1;
for(int i = 1; i <= (.5 * length); i++)
{
while(!isalnum(*left))
{
*left++;
}
while(!isalnum(*right))
{
*right--;
}
if(tolower(*left) != tolower(*right))
{
return false;
}
else
{
*left++;
*right--;
}
}
return true;
}
void putPalindrome ( char line[] )
{
palinFile << line << "\n";
}
void notPalindrome ( char line[] )
{
nonPalinFile << line << "\n";
}
void numbers ( int palin, int nonPalin )
{
palinFile << "\nThere were " << palin << " palindromes.";
nonPalinFile << "\nThere were " << nonPalin << " non-palindromes.";
}