I’m doing a C++ assignment on Stacks and I am suppose to readthe file and write a while loop to print out the name in reverseorder first after that I’m suppose to write another while loop andprint out the name is correct order. But I’m getting a segmentationfault would you please help me figure out this code what can i doto print out the name i same order? Thank you. Right now my codeonly prints out the name is reverse order, I need to print it outthe other way around using the while loop.
#include <iostream>
#include <fstream>
#include <cassert>
#include <string>
#include <stack>
using namespace
OR
OR