1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
#include <iostream>
#include <string>
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
using namespace std;
int main(){
int numAuthors;
int numEditors;
bool datePublished;
string author[5];
string editor[5];
string date;
string title;
string dateAc;
string terminate;
string url;
cout << "Welcome to Fang's MLA Citation Service!" << endl;
cout << "Number of known authors : ";
cin >> numAuthors;
cout << endl;
if (numAuthors > 0){
cout << "Please enter the first author's name \"LAST, FIRST M.\"" << endl << "and other author's name \"FIRST M. LAST\"..." << endl;
for(int i = 0; i < numAuthors; i++){
cout << "Author " << (i+1) << ": ";
cin.ignore(256, '\n');
getline(cin, author[i]);
cout << endl;
}
}
else author[0] = "";
cout << "Website title: ";
//cin.ignore(256, '\n');
getline(cin, title);
cout << endl << "Number of Website Editors: ";
cin >> numEditors;
cout << endl;
if (numEditors > 0){
cout << "Please enter the editor's name(s) \"FIRST M. LAST\"..." << endl;
for(int i = 0; i < numEditors; i++){
cout << "Editor " << (i+1) << ": ";
cin.ignore(256, '\n');
getline(cin, editor[i]);
cout << endl;
}
}
else editor[0] = "N.p.";
cout << "Is there a date published? ";
cin >> datePublished;
cout << endl;
if (datePublished){
cout << "Date \"DATE MONTH YEAR\": ";
cin.ignore(256, '\n');
getline(cin, date);
}
else date = "N.d.";
cout << endl << "Enter date accessed \"DATE MONTH YEAR\": ";
//cin.ignore(256, '\n');
getline(cin, dateAc);
cout << endl << "Enter URL: ";
//cin.ignore(256, '\n');
getline(cin, url);
cout << endl << "Finished Citation:" << endl;
for(int i = 0; i < numAuthors; i++){
cout << author[i];
if(i < numAuthors-1) cout << ", ";
if (i == numAuthors-1 && numAuthors > 1) cout << "and ";
}
cout << ". <i>" << title << ".</i>";
if(numEditors > 0) cout << " Ed. ";
for(int i = 0; i < numEditors; i++){
cout << editor[i];
if(i < numEditors-1) cout << ", ";
if (i == numEditors-1 && numEditors > 1) cout << "and ";
}
cout << ". " << date << ". Web. " << dateAc << ". <" << url << ">." << endl << endl << "Type something random to end the program: ";
cin >> terminate;
return 0;
}
|