I'm a student at Virginia Tech and taking a c++ introduction course. I am a complete noob in c++ and programming in general...have had a little bit of experience with matlab which is quite different than c++.
Anyways, when I try to compile my code, I receive the error message "function-style initializer appears to be a function definition"
can someone explain to me what this means?
I set up the function prototypes in main() and then used the function out of the main loop..
Here's an example of one of the errors:
It looks like it's because the return type does not match, double in the prototype void in the implementation. Also the argument list needs to have the variable types. The variable name (not the type) is optional for the prototype, but still recommended for code clarity.
You're also missing the type for the variable feetperSec, you could also just skip that variable and write:
return (complex equation);
Hey thanks a lot rossipoo...but now it will compile with 4 errors saying "uninitialized local variable used - obsWeight"...it has the same error for obsTime , obsK, and feetperSec...not sure why because these variables look like they are initialized to me:
#include <iostream> // for cout, if needed for debugging
#include <fstream> // for file stream support
#include <iomanip> // for formatting support
#include <cmath> // for standard math functions, if needed
#include <string> // for character string type
using namespace std; // put all of that in scope
int main() {
string obslName; // observed last name of skydiver
string obsfName; // observed first name of skydiver
string name; // outputted full name of skydiver
double obsWeight; // observed weight
double obsK; // observed drag coefficient
double gravity = 32.2; // acceleration of gravity in ft/sec
double feetperSec; // (computed) velocity of skydiver in ft/sec
double obsTime; // observed time of fall
ifstream Data("Input.txt"); // opens the input file
ofstream Log("Output.txt"); // opens the output file