There is a Segmentation Fault on line cin >> num; for integer type.
cin >> num;
#include using namespace std; int main(void) { int