I put another brace before the first catch and I still get errors

try {
while (cin) {
        cout << expression() << '\n';
        keep_window_open();
}
}

.cpp: In function `int main()':
.cpp:12: parse error before `&' token
.cpp:12: syntax error before `&' token
.cpp:14: ISO C++ forbids declaration of `keep_window_open' with no type
.cpp:15: parse error before `return'
.cpp:19: ISO C++ forbids declaration of `keep_window_open' with no type
.cpp:20: parse error before `return'


Brett McCoy <[EMAIL PROTECTED]> wrote:                               On Feb 17, 
2008 9:58 AM, Robert Ryan <[EMAIL PROTECTED]> wrote:
 >    I put a brace at the while loop and took out the int at 
 > keep_window_open();
 > but I have this error at catch
 
 Your while loop is closed but your try isn't. It should be like
 
 try {
    while {
       ...
     }
 }
 catch ...
 
 >   #include<iostream>
 >   using namespace std;
 >   expression();
 >   keep_window_open();
 >   int main()
 >   try {
 >   while (cin) {
 >           cout << expression() << '\n';
 >           keep_window_open();
 >   }
 >   catch (runtime_error& e) {
 >           cerr << e.what() << endl;
 >           keep_window_open();
 >           return 1;
 >   }
 >   catch (...) {
 >           cerr << "exception \n";
 >           keep_window_open();
 >           return 2;
 >   }
 >
 >
 >   .cpp: In function `int main()':
 >   .cpp:11: parse error before `catch'
 >
 >
 > ---------------------------------
 > Never miss a thing.   Make Yahoo your homepage.
 >
 >
 > [Non-text portions of this message have been removed]
 >
 >
 >
 > To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
 > Yahoo! Groups Links
 >
 >
 >
 >
 
 -- 
 ----------------------------------------------------------
 "In the rhythm of music a secret is hidden;
     If I were to divulge it, it would overturn the world."
                -- Jelaleddin Rumi
 
     
                               

       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.

[Non-text portions of this message have been removed]

Reply via email to