0 évaluation0% ont trouvé ce document utile (0 vote)
136 vues2 pages
Program to turn standard txt into the NATO phonetic alphabet and back again. Uses standard input and output stream #include / / ising the file manipulation stream. Uses the standard namespace std.
Program to turn standard txt into the NATO phonetic alphabet and back again. Uses standard input and output stream #include / / ising the file manipulation stream. Uses the standard namespace std.
Droits d'auteur :
Attribution Non-Commercial (BY-NC)
Formats disponibles
Téléchargez comme TXT, PDF, TXT ou lisez en ligne sur Scribd
Program to turn standard txt into the NATO phonetic alphabet and back again. Uses standard input and output stream #include / / ising the file manipulation stream. Uses the standard namespace std.
Droits d'auteur :
Attribution Non-Commercial (BY-NC)
Formats disponibles
Téléchargez comme TXT, PDF, TXT ou lisez en ligne sur Scribd
//Program to turn standard txt into the NATO phonetic alphabet and back again
#include <iostream> //using the standard input and output stream
#include <fstream> // ising the file manipulation stream #include <string> // using the string stream #include <sstream> // so we can manipulate strings like streams using namespace std; //using the standard namespace int a; long sourceFileSize; long convertionFileSize; string convertionFile; string sourceFile; int findSourceFileSize () //function to determind the filesize of the original f ile { char filename[16]; //this will allow the file name be 16 in length cout << "Enter the name of an existing file: "; cin.getline (filename,16); cout << "\nThe name of your file is: " << filename << endl; long begin, end; //initializing the variabls that will hold the value fo r our beging and end value of bytes ifstream myfile; myfile.open(filename); //bind the file to our input file stream begin = myfile.tellg(); //find the value for the beginning. myfile.seekg(0, ios::end); //navigate to the end of the file end = myfile.tellg(); //find the value for the end myfile.close(); //stop dealing with this file sourceFileSize = end-begin; return (sourceFileSize); //finish the function } int findConvertionFileSize () //funtion to determind filesize of the converted f ile. { long begin, end; ifstream myfile; myfile.open ("Convertion.txt"); begin = myfile.tellg(); //find the value for the beginning. myfile.seekg(0, ios::end); //navigate to the end of the file end = myfile.tellg(); //find the value for the end myfile.close(); //stop dealing with this file convertionFileSize = end-begin; return (convertionFileSize); //finish the function } int createConvertionFile () { ofstream myfile; myfile.open ("Convertion.txt"); myfile << "============================================================= =\n"; myfile << "======Thankyou=For=Using=NAME's=Text=->=NATO=Converter======\ n"; myfile << "============================================================= =\n" << endl << endl << endl << endl << "--->" << endl; myfile.close(); convertionFile = "Convertion.txt"; return 0; } int main() //start the program { cout << "WELCOME TO NAME'S STANDARD TEXT TO NATO PHONETIC ALPHABET CONVE RTER" << endl; findSourceFileSize (); cout << "Source File Size Is: " << sourceFileSize << " Bytes." << endl; cout << sourceFile << endl; createConvertionFile (); //Analyze Source File //Convert File findConvertionFileSize (); cout << "Your Convertion File Is Named: " << convertionFile << endl; cout << "Converted File Size Is: " << convertionFileSize << " Bytes." << endl; cin >> a; return 0; }