| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Rock Weight Error
I am having trouble fixing the problems in this porgram. Thanks for any help anyone can provide.
#include <iostream> int main() { float caratWt, // Weight of stone in carats millWt, // Weight of stone in milligrams gramWt, // weight of stone in grams ounceWt; // Weight of stone in ounces // Prompt the user for the weight of a precious stone in carats. cout << endl; //endl will cause a line return on the monitor cout << "Enter a precious stone's weight (in carats) " cin>>caratWt; // Convert from carats to milligrams.e number of milligrams? millWt = caratWt * 200; cout << "This stone weighs " << millWt << " milligrams." << endl; // Convert from milligrams to grams. gramWt = millWt * 1000; cout << "This stone weighs " << gramWt << " grams." << endl; // Convert from grams to ounces. ounceWt = gramWt / 28.35; cout << "This stone weighs " << ounceWt << " ounces." << endl; } .................................................. ... Test 03.cpp: In function `int main()': Test 03.cpp:11: error: `cout' undeclared (first use this function) Test 03.cpp:11: error: (Each undeclared identifier is reported only once for each function it appears in.) Test 03.cpp:11: error: `endl' undeclared (first use this function) Test 03.cpp:13: error: syntax error before `>>' token |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Rock Weight Error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|