How to fix error "expected unqualified-id at end of input"?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nishant Agnihot
    New Member
    • Jan 2011
    • 1

    How to fix error "expected unqualified-id at end of input"?

    Code:
    #include<iostream>
    #include<cstdlib>
    using namespace std;
    class stack{
    	public : int size, top, s[];
    	stack(int s){
    		size = s;
    		top = 0;
    	}
    	void push(char c){
    		if(top==(size - 1)){
    			cout<<"Stack overflow\n";
    			exit(1);
    		}
    		else{
    			s[++top] = c;
    		}
    	}
    	char pop(){
    		if(top == -1){
    			cout<<"Stack underflow\n";
    			exit(1);
    		}
    		return s[top--];
    		
    	}
    }
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    you missed the ; after the last } on line 27 at the end of the class definition

    Comment

    Working...