Tuesday, February 14, 2012

HAPPY VALENTINES TO PEOPLE.

Because i'm others are enjoying it and not spending it alone, at home, in bed, eating chocolate like i am.
FOREVER ALONE D:


But whatevs.
I actually spent most of today programming.


I was working on some tutorial stuff (might work on some more later).
And i was really enjoying it.
I'm glad i switched to the programming course.
(I'll post the code in my latest programming session at the end of the blog post. Be warned, it's REALLY long, haha)



I also played the Mass Effect 3 demo a couple of days ago.
It was enjoyable, but only lasted about half an hour...
I have yet to try the multiplayer yet, as when i tried before, EA's servers were down (go figure).



And as of today, i raised my "Games that iv'e already ordered and are coming in-" up to 3.
I'm not awaiting:


-Arcana Heart 3, at some time this week.
-The Last story, at the end of the month

-Mass Effect 3, next month

-Ghost Recon: Future Soldier, in a few months time

Amazingly only 1 is a PS3 title, the other 2 are xbox, and at the highpoint of amazingness; one of them is a WII TITLE.


Yeah.
Been a while since iv'e gotten a wii game...

Also, in other unrelated news.


I broke my glasses last week.
So now i'm blind.
So yeah.
That's a thing...

The first day of uni back was also really good.
Hanging out with Sean and Travis was awesome.
Cool guys and i'm glad to be working with them.


Now i'm just awaiting my Thursday class to see what that's like.
But all the cool people are in my tutorial group.
So it should be good.

Well, that's it.
Not much else...
but as promised, i will post the extremely long code.
Goodbye.

#include <iostream>
#include <math.h>
void squareArea()
{
float sqArea = 0;
std::cout << "Please type in the length of the squares side: ";
std::cin >> sqArea;
float ans = sqArea * sqArea;
std::cout << "The area of the sqaure is: " << ans << std::endl;
}
void triangleArea()
{
float triBase = 0;
float triHeight = 0;
std::cout << "Please type in the length of the traingles base: ";
std::cin >> triBase;
std::cout << "Please type in the length of the traingles hieght: ";
std::cin >> triHeight;
float ans = (triBase / 2) * triHeight;
std::cout << "The area of the triangleis: " << ans << std::endl;
}
void circleArea()
{
float pi = 3.141592654;
float ciRadius = 0;
std::cout << "Please type in the circles radius: ";
std::cin >> ciRadius;
float ans = pi * (ciRadius * ciRadius);
std::cout << "The area of the circle is: " << ans << std::endl;

}
void circleCircumference()
{
float pi = 3.141592654;
float ciRadius = 0;
std::cout << "Please type in the circles radius: ";
std::cin >> ciRadius;
float ans = 2 * pi * ciRadius;
std::cout << "The circumference of the circle is: " << ans << std::endl;

}
void cubeVolume()
{
float cubeSide = 0;
std::cout << "Please type in the length of the cubes side: ";
std::cin >> cubeSide;
float ans = cubeSide * cubeSide * cubeSide;
std::cout << "The volume of the cube is: " << ans << std::endl;

}
void cubeSurface()
{
float cubeSide = 0;
std::cout << "Please type in the length of the cubes side: ";
std::cin >> cubeSide;
float ans = 6 * (cubeSide * cubeSide);
std::cout << "The surface area of the cube is: " << ans << std::endl;

}
void trapSurfaceAndVolume()
{
float trapBase1 = 0;
float trapBase2 = 0;
float trapHeight = 0;
float trapSide1 = 0;
float trapSide2 = 0;
float trapLength = 0;
std::cout << "Please type in Base 1 of the trapezoid: ";
std::cin >> trapBase1;
std::cout << "Please type in Base 2 of the trapezoid: ";
std::cin >> trapBase2;
std::cout << "Please type in Side 1 of the trapezoid: ";
std::cin >> trapSide1;
std::cout << "Please type in Side 2 of the trapezoid: ";
std::cin >> trapSide2;
std::cout << "Please type in the height of the trapezoid: ";
std::cin >> trapHeight;
std::cout << "Please type in the Length of the trapezoid: ";
std::cin >> trapLength;
float trapVol = (trapBase1 + trapBase2 + trapSide1 + trapSide2) * trapLength;
float trapSurface = (trapBase1 + trapBase2) * trapHeight / 2;
std::cout << "The volume of the trapezoid is: " << trapVol << ", and the surface area of the trapezoid is: " << trapSurface << std::endl;

}
void elipArea()
{
float pi = 3.141592654;
float P = 1.6075;
float sideA = 0;
float sideB = 0;
float sideC = 0;
std::cout << "Please type in the length of side A: ";
std::cin >> sideA;
std::cout << "Please type in the length of side B: ";
std::cin >> sideB;
std::cout << "Please type in the length of side C: ";
std::cin >> sideC;
float ans = 4 * pi * (((sideA * P) * (sideB * P) + (sideA * P) * (sideC * P) + (sideB * P) * (sideC * P)) / 3) * 1 / P;
std::cout << "The surface area of the ellipsoid is: " << ans << std::endl;

}
void pyrVolume()
{
float base = 0;
float height = 0;
std::cout << "Please type in the side length of the pyramids base: ";
std::cin >> base;
std::cout << "Please type in the hight of the pyramid: ";
std::cin >> height;
float ans = (1 / 3) * (base * base) * height;
std::cout << "The volume fo the pyramid is: " << ans << std::endl;
}
void triPrisVolume()
{
float length = 0;
float height = 0;
float width = 0;
std::cout << "Please type in the width of the triangular prism: ";
std::cin >> width;
std::cout << "Please type in the height of the triangular prism: ";
std::cin >> height;
std::cout << "Please type in the length of the triangular prism: ";
std::cin >> length;
float ans = (1 / 2) * width * length * height;
std::cout << "The volume for the triangular prism is: " << ans << std::endl;
}
void cylVolume()
{
float pi = 3.141592654;
float radius = 0;
float height = 0;
std::cout << "Please type in the radius of the cylinder: ";
std::cin >> radius;
std::cout << "Please type in the height of the cylinder: ";
std::cin >> height;
float ans = pi * (radius * radius) * height;
std::cout << "The volume for the cylinder is: " << ans << std::endl;
}
void timeGravity()
{
float distance = 0;
float gravity = 0;
std::cout << "Please type in the distance of the object (in metres): ";
std::cin >> distance;
std::cout << "Please type in the level of gravity (in m/s2): ";
std::cin >> gravity;
float ans = sqrt((2 * distance) / gravity);
std::cout << "The time taken for the object to travel is: " << ans << " seconds" << std::endl;
}

void funChoice()
{
float choice = 0;
std::cout << "..." << std::endl;
std::cout << "Please type the number corresponding to the function" << std::endl;
std::cin >> choice;
if(choice == 1)
{
squareArea();
}
else if(choice == 2)
{
triangleArea();
}
else if(choice == 3)
{
circleArea();
}
else if(choice == 4)
{
circleCircumference();
}
else if(choice == 5)
{
cubeVolume();
}
else if(choice == 6)
{
cubeSurface();
}
else if(choice == 7)
{
trapSurfaceAndVolume();
}
else if(choice == 8)
{
elipArea();
}
else if(choice == 9)
{
pyrVolume();
}
else if(choice == 10)
{
triPrisVolume();
}
else if(choice == 11)
{
cylVolume();
}
else if(choice == 12)
{
timeGravity();
}
else
{
funChoice();
}

}


void main()
{
std::cout << "Welcome to the math calculator thing" << std::endl;
std::cout << "These are the currently available maths functions:" << std::endl;
std::cout << "1 -Area of a square" << std::endl;
std::cout << "2- Area of a triangle" << std::endl;
std::cout << "3- Area of a circle" << std::endl;
std::cout << "4- Circumference of a circle" << std::endl;
std::cout << "5- Volume of a cube" << std::endl;
std::cout << "6- Surface area of a cube" << std::endl;
std::cout << "7- Volume and Surface area of a trapezoid" << std::endl;
std::cout << "8- Area of an ellipsoid" << std::endl;
std::cout << "9- Volume of a square based pyramid" << std::endl;
std::cout << "10- Volume of a triangular prism" << std::endl;
std::cout << "11- Volume of a cylinder" << std::endl;
std::cout << "12- Time for an object to fall to the ground from a given height at given gravity in a vacuum" << std::endl;
funChoice();
}

4 comments:

  1. Dude, being forever alone isn't a bad thing. I'lll fill you in on my current situation and you'll be grateful for forever alone -.-

    Also, seriously, that isn't coding :P I did more than that in my Year 9 programming class! Although it was in nice, simple Visual BASIC...

    ReplyDelete
  2. haha, yeah. Iv'e definitely done a lot more on different things then i have on this.
    But it's a good amount of work considering in only touched C++ for the first time on monday :D

    ReplyDelete