0% found this document useful (0 votes)
31 views6 pages

Project in ITE 103

This C++ program allows a user to input student information including ID number, name, course, and year and saves it to a text file. The user can choose to continuously add new student records or exit the program. It uses file input/output streams to open and write to a text file called "Suerto.txt". Student data fields are separated by tabs when written to the file.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views6 pages

Project in ITE 103

This C++ program allows a user to input student information including ID number, name, course, and year and saves it to a text file. The user can choose to continuously add new student records or exit the program. It uses file input/output streams to open and write to a text file called "Suerto.txt". Student data fields are separated by tabs when written to the file.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Project In ITE-103

Submitted by:
John Mark V. Suerto

Submitted to:

Kevin V. Cebedo

#include <iostream>

#include <fstream>

#include <string.h>

using namespace std;

main ()

ofstream file;

file.open ("Suerto.txt");

if (file.is_open())

string IDnum,LastName,FirstName,MiddleInitial,Course,Year;

cout << "Enter student's ID number: " <<endl;

cin >> IDnum;


cout << "Enter student's last name: " <<endl;

cin >> LastName;

cout << "Enter student's first name: " <<endl;

cin >> FirstName;

cout << "Enter student's middle initial: "<<endl;

cin >> MiddleInitial;

cout << "Enter student's course: "<<endl;

cin >> Course;

cout << "Enter student's college year: "<<endl;

cin >> Year;

file << IDnum << "\t" << LastName << "\t" << FirstName << "\t" <<
MiddleInitial << "\t" << Course << "\t" << Year<<endl;

string option;

cout << "1. Add student info: " <<endl;

cout << "2. Exit program " <<endl;

cin >> option;


if(option == "1")

string var = "Y";

cout << "Continue? Y/N: " <<endl;

cin >> var;

while(var == "Y" || var == "y")

string IDnum,LastName,FirstName,MiddleInitial,Course,Year;

cout << "Enter student's ID number: " <<endl;

cin >> IDnum;

cout << "Enter student's last name: " <<endl;

cin >> LastName;

cout << "Enter student's first name: " <<endl;

cin >> FirstName;

cout << "Enter student's middle initial: "<<endl;

cin >> MiddleInitial;

cout << "Enter student's course: "<<endl;

cin >> Course;


cout << "Enter student's college year: "<<endl;

cin >> Year;

file << IDnum << "\t" << LastName << "\t" << FirstName << "\t"
<< MiddleInitial << "\t" << Course << "\t" << Year<<endl;

cout << "Do you want to add another student's info? "<<endl;

cin >> var;

file.close();

system("pause");

You might also like