Terminate called after throwing an instance of 'char const*'?

Did a little bit of research and those were all saying something about "catch"... Didn't get it...

Thank you.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;

int main(){
	ifstream fin;
	fin.open("ummmm.xls");
	if(!fin.good())throw "I/O error";
	
	const int ROWS = 4;
	const int COLS = 3;
	string hmmmm[ROWS][COLS][7] = {{"Name", "Grade", "Gender"},
				 {"Alexa", "10", "Female"},
				 {"Alex", "9", "Male"},
				 {"Alexis", "11", "Male"}};

	for(int j = 0; j < COLS; j++){
		for(int i = 0; i < ROWS; i++){
			fout << setw(10) << hmmmm[ROWS][COLS];
		}
	}
	fin.close();
}
Last edited on
I noticed the problem on line 21... However that still didn't solve the problem after I fixed that...
There are two errors on line 21 (at least) - non-existent fout and, sort of, writing beyond array bounds.

You definitely don't need the extra dimension [7] on line 14: these are std::string, not c-strings.

Are you sure that you are going to read from a .xls file? I doubt it. Also, you appear very confused as to whether you are inputting or outputting.
Last edited on
Topic archived. No new replies allowed.