A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

My first Math Program

1.4k views · started by ksrocks333 ·
#1
My first Math Program
This is a simple program I made using some void functions and the math.h file thing. I did it in c++. If you want the source code tell me.
It's my first one, I'm looking for feedback, but it says all that in the program so yeah.
Download here:

my math program.zip

Tell me if that download link doesn't work.

I think I did this right, I put it in a winrar zip thing...XD

It should work...right?

I scanned it to make sure there weren't viruses:

Scanners
[arcavir]
2010-03-20 Found nothing
[F-Secure Anti-Virus]
2010-03-21 Found nothing
[A-Squared]
2010-03-21 Found nothing
[G DATA]
2010-03-21 Found nothing
[Avast! antivirus]
2010-03-21 Found nothing
[ikarus]
2010-03-21 Found nothing
[Grisoft AVG Anti-Virus]
2010-03-21 Found nothing
[Kaspersky Anti-Virus]
2010-03-21 Found nothing
[Avira AntiVir]
2010-03-19 Found nothing
[ESET NOD32]
2010-03-21 Found nothing
[Softwin BitDefender]
2010-03-21 Found nothing
[Panda Antivirus]
2010-03-21 Found nothing
[clamav]
2010-03-20 Found nothing
[Quick Heal]
2010-03-19 Found nothing
[cpsecure]
2010-03-21 Found nothing
[sophos]
2010-03-21 Found nothing
[Dr.Web]
2010-03-21 Found nothing
[VirusBlokAda VBA32]
2010-03-19 Found nothing
[Frisk F-Prot Antivirus]
2010-03-20 Found nothing
[virusbuster]
2010-03-20 Found nothing
[/virusbuster][/sophos][/cpsecure][/clamav][/ikarus][/arcavir]
#2
Doesn't work. Nuff said.
#3
Chad wrote:
Doesn't work. Nuff said.


Can you please help me with what error your getting? Why does it work perfectly for me D:

Does it have to do with the fact I coded in C++?

Source Code:

#include <iostream.h>
#include <math.h>
using namespace std;

const double PI = 3.14159265;



void sum(double x, double y)
{
cout<<x<<"+"<<y<<"="<<x+y<<endl;
}
void sub(double x, double y)
{
cout<<x<<"-"<<y<<"="<<x-y<<endl;
}
void mult(double x, double y)
{
cout<<x<<"*"<<y<<"="<<x*y<<endl;
}
void div(double x, double y)
{
cout<<x<<"/"<<y<<"="<<x/y<<endl;
}
void mid(double x, double y)
{
cout<<"The midpoint of "<<x<<" and "<<y<<" is: "<<(x+y)/2<<endl;
}
void grad(double x, double y)
{
cout<<"Your grade of "<<x<<" out of "<<y<<" is: "<<(x/y)*100<<"%"<<endl;
}



int main()
{
double n1, n2, param, ans1, ans2, ans3, base, expon, rbase, rans, aval;
cout<< "-------------------A simple math program by Robyn------------------------------"<<endl;
cout<<endl;
cout<< "This is my first program using void functions and the math.h file, I had fun "<<endl;
cout<< "making this, I would like your opinions of the program. Also, tell me the "<<endl;
cout<< "errors you find."<<endl;
cout<< "-Robyn"<<endl;
cout<<endl;
cout<< "**After inputing a number when prompted, hit enter to get answer and continue to";
cout<< "the next function. :D **"<<endl;
cout<< "-------------------------------------------------------------------------------";
cout<<endl;
cout<< "A few basic math functions."<<endl;
cout<< "Enter a number: ";
cin>>n1;
cout<< "Enter another number: ";
cin>>n2;
cout<<endl;
sum(n1, n2);
sub(n1, n2);
mult(n1, n2);
div(n1, n2);
mid(n1, n2);
grad(n1, n2);
cout<<endl;
cout<< "-------------------------------------------------------------------------------";
cout<<endl;
cout<< "Now for some more complicated functions."<<endl;
cout<< "Enter a degree (1-360): ";
cin>>param;
ans1 = cos(param*PI/180);
cout << "Cosine of " << param << " degrees is " << ans1;
cout<<endl;
ans2 = sin (param*PI/180);
cout << "Sine of " << param << " degrees is " << ans2;
cout<<endl;
ans3 = tan(param*PI/180);
cout << "Tangent of " << param << " degrees is " << ans3<<endl;
cout<< "-------------------------------------------------------------------------------";
cout<<endl;
cout<< "These are some useful functions to save time"<<endl;
cout<< "Enter a base number: ";
cin>>base;
cout<< "Enter an exponent: ";
cin>>expon;
cout<<base<<"^"<<expon<<"="<<pow(base, expon);
cout<<endl;
cout<< "-------------------------------------------------------------------------------";
cout<<endl;
cout<<"Square root functions."<<endl;
cout<< "Enter a number to find the square root of: ";
cin>>rbase;
rans = sqrt (rbase);
cout<< "The square root of "<<rbase<<" is "<<rans;
cout<<endl;
cout<< "-------------------------------------------------------------------------------";
cout<<endl;
cout<< "Absolute value."<<endl;
cout<< "Enter a number (Only negative will show change): ";
cin>>aval;
cout<< "The absolute value of "<<aval<<" is "<< fabs(aval);
cout<<endl;
cout<<endl;
cout<<"That's all for now. Tell me what you think I could add to the program.";
cout<<endl;
cout<< "--------This program belongs to Robyn. DONT STEAL (without asking) (lol)-------";
cout<<endl;
system ("PAUSE");
return 0;
}




EDIT. It's working on both my computers. One of which I've never downloaded any C++ programs before.
#4
There is no error. Just doesn't start up because someone who created it didn't include the .dll's into the project. >x>
#5
Chad wrote:
There is no error. Just doesn't start up because someone who created it didn't include the .dll's into the project. >x>


The .dll's? i'm not following? It's just supposed to come up as a command prompt thing with a blackground, no skin or buttons or anything. Just basic.

Also, if that's not what a dll is, I didn't add any dll's when I sent it to my other comp, so how did it work on there? D:

Pic of what it should look like:
#6
Chad it works... o.O
Even on my screwed up computer...
Make sure you have the C++ Runtime files...

@KsRocks You should program with VB / C# you have potential...
#7
Chad it works... o.O
Even on my screwed up computer...
Make sure you have the C++ Runtime files...

@KsRocks You should program with VB / C# you have potential...
Oh great, now I know it works, that Eternal.

Oh, I have potential? This is good. Do you have any beginner VB guides that you used? Because I have no idea where to start.
#8
You don't have to start with C#, or Vb.net. You can make programs in C++. No one really cares. We all use different languages here.
#9
Chad wrote:
You don't have to start with C#, or Vb.net. You can make programs in C++. No one really cares. We all use different languages here.


C++ is "the most reknown"
C# is "simple and powerful"
VB is "the most powerful"

Just what I have heard...

And yes you have potential... I will post my Vid Tutorial Channel...
#10
C++ is "the most reknown"
C# is "simple and powerful"
VB is "the most powerful"

Just what I have heard...

And yes you have potential... I will post my Vid Tutorial Channel...


Thanks for the quotes ED. XD

What's the link to the vids?
#11
i'd like to differ Eternal:

C++ is the most used and powerful.

C# is well known and powerful

VB is simple and powerful yet for beginners.