No Compile Option - Microsoft Visual Studio 2013

Hey everybody! I'm new to the forum so I apologize if this isn't how you formally post a question.. but I can't figure out how to get this right. There isn't any option to compile my code. I have tried starting a new project/file and to no avail. I opened previous files and it allows me to compile but for some reason it wont appear. If needed, here is the code I'm entering.

Write a program that accepts as input the mass, in grams, and density, in grams per cubic centimeters, and outputs the volume of the object using the formula: volume = mass / density. Format your output to two decimal places. 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  #include <conio.h> // For function getch()
#include <cstdlib>  // For several general-purpose functions
#include <fstream>  // For file handling
#include <iomanip>  // For formatted output
#include <iostream>  // For cin, cout, and system
#include <string>  // For string data type
using namespace std;  // So "std::cout" may be abbreviated to "cout"

int main()
{
	volume  = mass  / density
	float g;
	float d;
	float volume;

	{
		cout << "Please input the mass in grams: ";
		cin >> g >> endl;
		cout << "Please input the density in grams per cubic centimeter: ";
		cin >> d >> endl;
		volume = g / d;
		cout << "Volume:" << volume << endl;
	}
	return 0;

}
There sure is, but you have to set it up properly.

When you first start VS, go to Project and create a New Windows Console Application. Follow the wizard. (This will involve naming your project, etc.)

Once you have that set up, you can put your code in your project's main .cpp file.

Once you have that much you can Build from the project menu (or from the project tree on the right).


The other option is to do it all from the command line: Start Menu → Microsoft Visual Studio <version> → Visual Studio Tools → choose one of the command prompt options.

Change to your .cpp file's directory. Run the compiler with something like:

    cl /EHsc /O2 myprogram.cpp

Assuming no errors, that will produce "myprogram.exe" in the same directory. You can now execute the program with a simple:

    myprogram

Hope this helps.
It did help! Thank you so much! You just saved me!
Topic archived. No new replies allowed.