I am attempting to write a program that starts with a void function (no parameters) I cannot get the "printmessage" function to display. If I remove the "int main" function the "printmessage" works fine. Part of my assignment is to display the printmessage function then proceed with more arithmetic and additional output statements. I am as newb as they come, please pardon any confusing terminology.
At one point I did get both functions to display but they were out of order.
I can take rough criticism so dont hold back.
#include <iomanip>
#include <iostream>
#include <cmath>
using namespace std;
You've misunderstood how C++ programs work. They start execution at main, and every other function only gets executed if it gets called. In your code, you defined the function printmessage(), but defining a function doesn't execute it. You still have to call it.
Immediately after I posted I figured it out, thanks for the reply. I do have another issue now, I cannot get my math to display anything except 0.00. "Capa" should display a number similar to "1.5583e-008"
This is my program complete except for the math:
#include <iomanip>
#include <iostream>
#include <cmath>
using namespace std;
That did it, I should have known that too. We discussed "scientific" last week. It's a great feeling seeing a program work, especially when its only my fifth one. Thanks for the help. I should be able to complete my next three assignments on my own.
Here's the working version:
#include <iomanip>
#include <iostream>
#include <cmath>
using namespace std;