C+ Writing a new program assume that you have been tasked with writing a new pro
ID: 3874793 • Letter: C
Question
C+ Writing a new program assume that you have been tasked with writing a new program describe what information should be contained in a comment block at the top of the program? C+ Writing a new program assume that you have been tasked with writing a new program describe what information should be contained in a comment block at the top of the program? Writing a new program assume that you have been tasked with writing a new program describe what information should be contained in a comment block at the top of the program?Explanation / Answer
#include <iostream>
#include <string>
#include <fstream>
int main()
{
using namespace std;
char nfn[256]; // nfn -- new file name
cout << "Enter a new file name : ";
cin >> nfn;
ofstream file(nfn);
if(file.is_open())
{
char lines[10][1024]; // detailed information about your program at max 100 lines
file << "/*" << endl;
cout << "Enter objective / question : ";
cin.getline(lines[0],1024);
file << "Objective / question : " << lines[0] << endl;
cout << "Enter author name : ";
cin.getline(lines[1],1024);
file << "Author name : " << lines[1] << endl;
cout << "Enter Written Date : ";
cin.getline(lines[2],1024);
file << "Written Date : " << lines[2] << endl;
cout << "Enter constanct required, if any : ";
cin.getline(lines[3],1024);
file << "constanct required, if any : " << lines[3] << endl;
cout << "Enter user inputs : ";
cin.getline(lines[4],1024);
file << "User inputs : " << lines[4] << endl;
cout << "Enter formulas required, if any : ";
cin.getline(lines[4],1024);
file << "Formulas required, if any : " << lines[3] << endl;
cout << "Enter general procedure, how to solve a problem : ";
cin.getline(lines[5],1024);
file << "Gneral procedure, how to solve a problem : " << lines[5] << endl;
cout << "List of functions/method names, if any : ";
cin.getline(lines[6],1024);
file << "List of functions/method names, if any : " << lines[6] << endl;
cout << "Functions/methods description, if any : ";
cin.getline(lines[7],1024);
file << "Functions/methods description, if any : " << lines[7] << endl;
cout << "Expcted output : ";
cin.getline(lines[8],1024);
file << "Expected output : " << lines[8] << endl;
file << "*/" << endl << endl;
}
}
I understand C+ as a C++, based on this understanding, i am going to C plus plus program.
The above program was successfully compiled and excuted under ubuntu operating system
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.