Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <conio.h>
- using namespace std;
- //Function used to represent interger a as a Roman Numeral string
- /*string romanNumeral (int a)
- {
- //numeral is intiliazed as a string object to store the result to be returned.
- string numeral;
- // Checks to see if the integer is positive
- if (a > 0)
- {
- //Loop is used to add M to the end of the string and subtract 1000 from the passed in integer
- while (a >= 1000)
- {
- numeral.append("M");
- a = a - 1000;
- }
- //Loop is used to add CM to the end of the string and subtract 900 from the passed in integer
- while (a >= 900)
- {
- numeral.append("CM");
- a = a-900;
- }
- //Loop is used to add d to the end of the string and subtract 500 from the passed in integer
- while (a >= 500)
- {
- numeral.append("D");
- a = a- 500;
- }
- //Loop is used to add CD to the end of the string and subtract 400 from the passed in integer
- while (a >= 400)
- {
- numeral.append("CD");
- a = a-400;
- }
- //Loop is used to add C to the end of the string and subtract 100 from the passed in integer
- while (a >= 100)
- {
- numeral.append("C")
- a = a - 100;
- }
- //Loop is used to add XC to the end of the string and subtract 90 from the passed in integer
- while (a >= 90)
- {
- numeral.append("XC");
- a = a - 90;
- }
- //Loop is used to add L to the end of the string and subtract 50 from the passed in integer
- while (a >= 50)
- {
- numeral.append("L");
- a = a - 50;
- }
- //Loop is used to add XL to the end of the string and subtract 40 from the passed in integer
- while (a >= 40)
- {
- numeral.append("XL");
- a = a - 40;
- }
- //Loop is used to add X to the end of the string and subtract 10 from the passed in integer
- while (a >= 10)
- {
- numeral.append("X");
- a = a - 10;
- }
- //Loop is used to add IX to the end of the string and subtract 9 from the passed in integer
- while (a >= 9)
- {
- numeral.append("IX");
- a = a - 9;
- }
- //Loop is used to add V to the end of the string and subtract 5 from the passed in integer
- while (a >= 5)
- {
- numeral.append("V");
- a = a - 5;
- }
- //Loop is used to add IV to the end of the string and subtract 4 from the passed in integer
- while (a >= 4)
- {
- numeral.append("IV");
- a = a - 4;
- }
- //Loop is used to add I to the end of the string and subtract 1 from the passed in integer
- while (a >= 1)
- {
- numeral.append("I");
- a = a - 1;
- }
- }
- else
- {
- return "Invalid entry";
- }
- return numeral;
- }
- */
- int main()
- {
- //Creates an integer to store the number from the file
- int toad = 0;
- // Creates a stream to open integer file
- ifstream mario("integers.txt");
- // Checks to see if file exists
- if (!mario)
- {
- cerr << "File does not exist\n";
- return(1);
- }
- //Iterates through the stream while it still returns anything but null
- while (mario >> toad)
- {
- cout << toad << ":\t" << romanNumeral(toad);
- }
- }
- 1>------ Build started: Project: hw01_9__11, Configuration: Debug Win32 ------
- 1>LINK : error LNK2001: unresolved external symbol _main
- 1>C:\Users\Thomas\documents\visual studio 2010\Projects\hw01_9__11\Debug\hw01_9__11.exe : fatal error LNK1120: 1 unresolved externals
- ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Add Comment
Please, Sign In to add comment