Computer Science, asked by andrewfernandos012, 5 months ago

4. Each node of a STACK contains the following information:
ii. Pin code of a city
ii. Name of city

Write a program to implement following operations in above stack.
b. PUSH()
b. POP()​

Answers

Answered by Anjalmaheshwari7070
2

Answer:

struct City { long Cpin ; char CName[20] ; City *Next ; } ; class Stack { City *Top; public: Stack( ) { Top = NULL; } void Push( ); void Pop( ); void Display( ); }; void Stack::PUSH( ) { City *Temp; Temp=new City; if(Temp= =NULL) { cout<<”\nNo memory to create the node…”; exit(1); } cout<<”\nEnter the City Pin Code to be inserted: “ cin>>Temp → Cpin; cout<<”\nEnter the City Name to be inserted: “; gets(Temp → CName); Temp → Next=Top; Top=Temp; } void Stack::POP( ) { City *Temp; if( Top= = NULL) cout<<”Stack Underflow…”; else { cout<<”\nThe City Pin Code for the element to delete: “<

Answered by supriyagoswami242001
2

Answer:

nhyyuikkkl

thanks dearest friend ❤️❤️❤️❤️❤️❤️

Similar questions