Hello ,
As a exercise I must calculate the square of the number 1 till 100.
I have this so far:
main.cpp
And square.h looks like this :Code:#include <algorithm> #include <iomanip> #include <ios> #include <iostream> #include <stdexcept> #include <string> #include <vector> #include "square.h" using namespace std; int main() { vector<int> nummer; int teller ; // filling the vector with the numbers 1 till 100 for (teller=0; teller < 100; teller++ ) { nummer.push_back(teller); } // compute and write the square for (teller=0 ; teller < 100 ; teller++) try { double uitkomst = wortel (nummer[teller]); // function where the square is computed. streamsize prec = cout.precision(); cout << setprecision(3) << uitkomst << setprecision(prec); } catch (domain_error e) { cout << e.what(); } cout << endl; } return 0; }
But when compiling I get this error message :Code:#include <stdexcept> #include <vector> #include <math> using namespace std; // compute the square double wortel (int nummer) { uitkomst = sqrt (nummer) ; return uitkomst }
C:\Users\wobben\Desktop\borland-source\chapter04\wortel\square.h|10|error: 'square' was not declared in this scope|
Im confused because I only use sqaure as name of the header file.
So where did I go wrong ?
Roelof



LinkBack URL
About LinkBacks



