fork download
  1. stack<int>s1;
  2. s1.push(source);
  3. while(!s1.empty())
  4. {
  5. x=s1.top();
  6. cout<<x<<endl;
  7. s1.pop();
  8. arra[x] = 1; // array is for visited purpose and is intitalized 0 before
  9. for(i = 1;i <= 5;++i)
  10. {
  11. if(arr[x][i] == 1&&arra[i] != 1){ // array is for adjacency matrix
  12. s1.push(i);
  13. //cout<<i<<"f"<<endl;
  14. }
  15. }
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:1: error: 'stack' does not name a type
 stack<int>s1;
 ^
prog.cpp:2:5: error: 's1' does not name a type
     s1.push(source);
     ^
prog.cpp:3:5: error: expected unqualified-id before 'while'
     while(!s1.empty())
     ^
stdout
Standard output is empty