Final Project CSCI 1300

# Final Project CSCI 1300 - /* 12 DEC 2007 Group II Project:...

This preview shows pages 1–3. Sign up to view the full content.

/* 12 DEC 2007 Group II Project: Federalist Papers //////////////////////////////////////////////////////////////////////////////// PURPOSE: Determine which of three papers were written by Hamilton, and which by Madison using seven unique words and their wordcount/totalwords ratio. TECHNIQUE: This program counts the number of times each word is found, and divides by the total number of words to find a ratio. This ratio is then subtracted from the theoretical ratios for both Hamilton and Madison and determines, using the absolute value function, which error is smaller. For each word, if Hamilton's ratio error is less, 1 is added to a counter. If Madison's ratio error is less, 1 is subtracted from a counter. The next step is analyzing the counter. If the counter is positive, the paper was written by Hamilton. If the counter is negative, it was written by Madison. If the counter reads zero, it was a tie (however, there are seven words, so a tie should never occur). //////////////////////////////////////////////////////////////////////////////// OUTPUT: THE COMPARITOR Group II Project: 12 DEC 2007 Enter filename: Fed10.txt > Madison wrote this paper. Enter filename: Fed29.txt > Hamilton wrote this paper. Enter filename: Fed51.txt > Madison wrote this paper. End of analysis: Press any key to continue . . . */ //////////////////////////HEADERS AND GLOBAL VARIABLES////////////////////////// #include <iostream> #include <fstream> #include <string> #include <cctype> #include <vector> #include <cmath>

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
using namespace std; vector<string> words(0,""); vector<float> hamilton(0,0); vector<float> madison(0,0); /////////////////////////////////METHODS/////////////////////////////////////// //Description: This method counts the number of times a character is found
This is the end of the preview. Sign up to access the rest of the document.

## This lab report was uploaded on 04/04/2008 for the course APPM 2360 taught by Professor Williamheuett during the Fall '07 term at Colorado.

### Page1 / 7

Final Project CSCI 1300 - /* 12 DEC 2007 Group II Project:...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online