#4
by あたっしゅ » 2年前
https://www.onlinegdb.com/ C++17
コード:
/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include <stdexcept>
#include <cstdlib>
int
main()
try{
throw std::runtime_error("hogehoge ...");
} catch (std::exception& e){
std::cerr << "エラー: " << e.what() << std::endl;
}
東上☆海美☆「
確かに、とおるっちゃみみ。
コード:
#include <iostream>
#include <stdexcept>
#include <cstdlib>
int
main()
try {
} catch(...) {
}
でとおるから、
の { の前に try が入って、catch が付いた、
と考えればいいのではみみ ?
」
https://www.onlinegdb.com/ C++17
[code]
/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include <stdexcept>
#include <cstdlib>
int
main()
try{
throw std::runtime_error("hogehoge ...");
} catch (std::exception& e){
std::cerr << "エラー: " << e.what() << std::endl;
}
[/code]
東上☆海美☆「
確かに、とおるっちゃみみ。
[code]
#include <iostream>
#include <stdexcept>
#include <cstdlib>
int
main()
try {
} catch(...) {
}
[/code]
でとおるから、
[code]
int
main()
{
}
[/code]
の { の前に try が入って、catch が付いた、
と考えればいいのではみみ ?
」