Question
how do you create a makefile for this? //Stack.h #pragma once #include #include #include using namespace std; template class Stack { struct Node { T
how do you create a makefile for this?
//Stack.h
#pragma once #include
template
T top() { return head->data; } void pop() { Node *tmp = head; head = head->next; delete tmp; } friend ostream& operator<<(ostream &out,Stack
=========================
//Student.h
#pragma once #ifndef STUDENT_H #define STUDENT_H #include
class Student { private: float gpa; string ssn; public: Student(); void setGPA(float v); void setSSN(string s); void print();
class OutOfGPARange { }; // empty inner class definition under public class InvalidSSN { }; // empty inner class definition under public }; #endif
===============================
#include
Student::Student() { gpa = 0; ssn = ""; } void Student::setGPA(float g) { //assert(g >= 0.0 && g <= 4.0);
//create an instance of the OutOfGPARange class, called exception if (g < 0.0 || g > 4.0) throw OutOfGPARange(); gpa = g; } void Student::setSSN(string s) { const int SSN_LENGTH = 9; if (s.length() != SSN_LENGTH) throw InvalidSSN(); //Checking each character is a digit should be here //Otherwise, throw InvalidSSN(); ssn = s; } void Student::print() { cout << "gpa: " << gpa << endl; cout << "ssn: " << ssn << endl; }
=========================
//Main.cpp
#include
int main() { //declare stack of int type Stack
}
/*Output Top of intStack is : 1 intStack items are : 1 2 3 4 5 intStack items after one pop operation: 2 3 4 5 Top of the stack is : gpa: 3.5 ssn: 333333333 Print stack after one pop operation: gpa: 3.5 ssn: 222222222 gpa: 3.5 ssn: 111111111
*/
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started