Need help starting/doing this lab

I need help with this problem, its supposed to read from an input.txt file, do what it says in the requirements section, and produce an output.txt file with the answer, but I have no idea where to start or how to start as I am relatively new to this and I did not properly learn C++ last semester because of the COVID situation going on(trying to relearn it now).

Problem:
You will create a C++ program store and short a list of game data. Your program will read an input file contain an entry name, and their score. Output the data in descending score order. The purpose of this lab is for you to practice linkedlist and sorting algorithm.

Requirement:
- A struct to store the name and score of an entry
- Linkedlist class to hold the game data
- Add and sort function for your linkedlist class

Input and Output:
a. Input file
- Valid input only if in <name>,<score> format.
- If <name> or <score> is missing -> invalid.
- If <name> or <score> contain comma -> invalid.
- Having spaces in <name> or <score> is valid.
- Invalid input should be ignored.
- Input might have \n or \r at the end of each line.

b. Output file
- Output the name entry and their respective score in descending order according to
the score.
- Spaces should be removed in the output.
- Output "No valid data in input" if input is empty or no valid input.

Examples:
input1.txt
S,norlax,99

ans1.txt
No valid data in input

input2.txt
Richard,10
Zoe,15

ans2.txt
Zoe,15
Richard,10

input3.txt
Pikachu ,30
Ditto ,20
Charmander,25
Squirtle,1 5

ans3.txt
Pikachu,30
Charmader,25
Ditto,20
Squirtle,15
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//	Courtesy of Furry Guy
#include <iostream>
#include <cctype>
#include <limits>

int main()
{
   std::cout << "Do you want someone to do all the work for you? ";
   char answer{};
   std::cin >> answer;
   std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
   if (std::toupper(answer) == 'Y' ) 
	{ std::cout << "Post it in the Jobs section.\n"; }
   else 
	{ std::cout << "Show what you have coded so far.\n"; }
   std::cout << "Good luck.\n";
   return 0;
}
It helps to write the program in steps.

1. Write a program that reads the input file. after reading each line, into a struct that represents a name and score, print the name and score, or something like "bad line". When you're done with this program, you'll have the code that parses the input file. Yay!

2. Add the linked list class store all the records. At this point, the linked list should have a constructor, an "add" method to add a struct to the list and a "print" method that prints all the structs in the list. Test this out. The output should be similar to the first program, but this one should read all the input before writing any output.

3. Add code to sort list the list.
My issue is that I really dont know how to do any of those things, I know basic C++ that I learned barely last semester by looking up tutorials on youtube and such, but it didnt really go into depth into what its asking me to do for this lab and my teacher didnt really help with explaining the topics or how to implement them so I am just completely lost
TinnyMintz wrote:
I really dont know how to do any of those things

Just dumping your assignment here, expecting others to do all the work for you, certainly won't help you learn.

Maybe pumping some neurons on your own with written text online C++ tutorials might be beneficial.

1. C++ Language Tutorial - http://www.cplusplus.com/doc/tutorial/

2. Learn C++ - https://www.learncpp.com/
do you know what a pointer is and how to use one?
if not, you may as well fail out now and repeat the previous course: a linked list is not unpossible but you need some background to crank one out, or all by itself you could spend days on just that.

My issue is that I really dont know how to do any of those things, I know basic C++ that I learned barely last semester by looking up tutorials on youtube and such, but it didnt really go into depth into what its asking me to do for this lab and my teacher didnt really help with explaining the topics or how to implement them so I am just completely lost


As a starting point, revise what you should know about C++ from https://www.learncpp.com/

There's nothing really complicated or difficult in the assignment. You need to understand:

- how to read text from a file
- how to parse delimited text into its elements
- using a struct to store data
- a linked list
- sorting a linked list

If you follow the steps suggested by dhayden above then you'll at least make a good start. If you can't even make start - even with help from the learncpp web site and your notes, then you need to talk to your teacher about re-doing the previous course.
I really don't know how to do any of those things
It sounds to me like you should drop the class. It has a C++ prerequisite and you don't meet it.
Topic archived. No new replies allowed.