Advertisement
ASP_Volume3 Coding Standards #60007

^!!~File Write~!!^

Prompts input and writes it to a file

AI

AIサマリー: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ソースコード
original-source
Upload
//by fritz300 of http://hax-studios.net
#include <fstream.h>
#include <iostream.h>
#include <stdlib.h>
int main()
{
	//** Declare Varibles, Theres only one
	char text[80];
	
	//** Declare pointers
	ifstream fin;
	ofstream fout;
	//** Begin; tell user what he/she is about to do
	cout << "Welcome to Fritzs Text Write program, This program (with source code included) \nwill teach you how to write text to files!\n\n";
	//** End;
	cout << "Type a word:\n";
	cin >> text;
	fout.open("c:/windows/desktop/file.txt"); //** Opens the file to write too.
	fout << "Fritzs Text Write Program Example:\n\nYou typed:\n\n\t";
	fout << text; //** Writes the input to file.txt
	fout.close();
	//** Error handler aka what happens if a error occurs
	if( !fin || !fout )
	{
		cout<<"Error has occured. Cannot open file.txt\n\n" << endl;
	}
	cout<<"\nText was successfully written to C:/windows/desktop/file.txt\n" << endl;
	cout << "\n\n\tText write program by Zak Farrington alias fritz owner of hAx Studios Ltd. <http://hax-studios.net> development team." << endl;
	system("PAUSE"); 
 	return 0;
}
Upload
オリジナルのコメント (3)
Wayback Machineから復元