|
Post by Zack Asiv on Oct 30, 2008 6:48:20 GMT -8
We've all thought it, there are a shit load of smart people here. If you need help with homework, or like me and need a place to keep your syntax for later, then post the problems your having here. Be kind and help each other out.
|
|
|
Post by Zack Asiv on Oct 30, 2008 6:48:41 GMT -8
#include "stdafx.h" #include <iostream> #include <string> using namespace std;
void main() { const double PI = 3.1415926535; double volume = 0.0; double radius = 0.0;
cout << " Please enter the radius of the sphere: "; cin >> radius; volume = 4.0/3.0*PI*radius*radius*radius; cout << "/nThe volume of the sphere of " << radius << " is: " << volume << "." << endl; }
(For my review later)
static_cast(double)(4/3)*PI*radius*radius*radius double average = 0.0 int temp1 = 90; int temp2 = 81;
average = static_cast<double>(test1 + test2) / 2.0;
-----------------
#include "stdafx.h" #include <iominip> #include <string> using std::string;
cout << setpercision(2) << fixed;
-----------------------
#include "stdafx.h" #include <iostream> #include <string>
using namespace std;
int main() { // declaratives begin here const int killVal = 1; const int headShots = 5; const int flagCap = 10;
int redScore = 0; int redKills = 0; int redHeadShots = 0; int redFlagCap = 0; int blueScore = 0; int blueKills = 0; int blueHeadShots = 0; int blueFlagCap = 0; string redTeamName = ""; string blueTeamName = "";
// Logic begins here
cout << "\t\tHALO Player Score calculator\n\n"; cout << "Enter Name for Red Team: "; getline(cin, redTeamName); cout << "Enter Name for Blue Team: "; getline(cin, blueTeamName);
// Red Team Stats
cout << "How many kills did Red Team get: "; cin >> redKills; cout << "How many Head Shots did Red Team get: "; cin >> redHeadShots; cout << "How many Flag Caps did Red Team get: "; cin >> redFlagCap;
// Blue Team Stats
cout << "How many kills did Blue Team get: "; cin >> blueKills; cout << "How many Head Shots did Blue Team get: "; cin >> blueHeadShots; cout << "How many Flag Caps did Blue Team get: "; cin >> blueFlagCap; redKills += killsVal; redHeadShots += headShots; redFlagCap += flagCap; blueKills += killsVal; blueHeadShots += headShots; blueFlagCap += flagCap;
redScore = (redKills + redHeadShots + flagCap)/3 blueScore = (blueKills + blueHeadShots + flagCap)/3
|
|
|
Post by seishounohana on Nov 2, 2008 8:54:51 GMT -8
Oooh <3 I like this. XD I hope you don't mind me advertising for myself as well. LOL. If anyone needs a tutor on Biology, Anatomy and physiology, Pathology, or any other medical related courses, don't hesitate to ring me up on MSN or PM me questions =D
|
|