can anyone help me with my assignment about sequential access file??
i have attach 2 file..its about my assignment question..

jwenting commented: homework kiddo, too lazy to even type out its assignment -2

Recommended Answers

All 5 Replies

And what exactly is your question?

And what exactly is your question?

the usual "do my homework for me!". Not a question at all, but an attempt by a lazy schoolkid to jumpstart itself into a management career by bossing total strangers around.

i have made some coding, but it is not correct 100%..here it is..

#include <iostream>
#include <fstream>
#include <cstdlib>
#include <iomanip>

using namespace std;

void main()
{
	char name[7];
	char course[5];
	int id;
	double tpv,tcc,gpa;

	ifstream masukanData;
	masukanData.open("data.txt",ios::in);

	ofstream keluaranData;
	keluaranData.open("gpa.txt",ios::out);


	if (!masukanData)
	{
		cout<<"File could not be opened \n";
		exit(1);
	}
	if (!keluaranData)
	{
		cout<<"File could not be opened \n";
		exit(1);
	}

	cout<<"Please refer to the file of Grade Point Average\n";

	masukanData >> id >> name >> course >> tpv >> tcc;

	while (id != 20102)
	{
		gpa = (tpv/tcc);

		keluaranData<<id<<setw(10)<<name<<setw(10)<<course<<setw(10)<<gpa<<endl;
		masukanData>>id>>name>>course>>tpv>>tcc;
	
	}
	
	
}

And what exactly is your question?

i want to know how i can add the text for labelling for every section; Student ID., Name, Course, tpv, tcc, and gpa??

i have put the label for every section in my coding, but i don't get the correct result..it always show the label in cmd prompt, not in inputFile(by using notepad)..so, in my coding, in which line that i must put the label??


here is the input that i do..hope anyone can correct it for me..

10026 SooJit Benc 47.88 18
10073 Vinod Beke 54.18 18
10095 Samad Benw 61.56 18
20053 Puvan Bmca 50.94 18
20084 Atiqah Bmcs 46.26 18
20101 LiLee Bmfu 58.14 18
20102

and this is the output i get..

10026 SooJit Benc 2.66
10073 Vinod Beke 3.01
10095 Samad Benw 3.42
20053 Puvan Bmca 2.83
20084 Atiqah Bmcs 2.57
20101 LiLee Bmfu 3.23

and how can i make the output like in a table..i mean the data is straight from up to bottom..not bent left and right..i have used setw() but it does not function correctly..

the usual "do my homework for me!". Not a question at all, but an attempt by a lazy schoolkid to jumpstart itself into a management career by bossing total strangers around.

it's not about "do my homework for me" at all..i am just wanted to get help from anyone who can correct my coding..sorry for not including the coding before..

and sorry for my English..hope u all can understand me..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.