Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, I cannot get this program to compile/work and I am hoping for some help. Her

ID: 3654546 • Letter: H

Question

Hi, I cannot get this program to compile/work and I am hoping for some help. Here is the code (the errors will follow the code) #include #include #include using namespace std; // FUNCTION PROTOTYPE read_us_length int read_us_length(int yards,int feet,int inches); // FUNCTION PROTOTYPE convert2inches int convert2inches(int yards,int feet,int inches); // FUNCTION PROTOTYPE convert2metric int convert2metric(int total_inches,int meters,int centimeters); // FUNCTION PROTOTYPE write_metric_length int write_metric_length(int meters,int centimeters); int main() { int yards, feet, inches; // length in yards, feet and inches int total_inches; // total length in inches int meters, centimeters; // length in meters and centimeters read_us_length(yards, feet, inches); total_inches = convert2inches(yards, feet, inches); convert2metric(total_inches, meters, centimeters); write_metric_length(meters, centimeters); return 0; } // DEFINE FUNCTION read_us_length HERE: int read_us_length(int yards,int feet,int inches) { if (yards<0) { cerr<<"Yards cannot be negative!"<<; void main(); } else if (feet<0) { cerr<<"feet cannot be negative!"<<; void main(); } else if (inches<0) { cerr<<"inches cannot be negative!"<<; void main(); } cout<<"FOR READING LENGTHS: "<<; cout<<"Enter yards: "<<; cin>>yards; cout<<"Enter feet: "<<; cin>>feet; cout<<"Enter inches: "<<; cin>>inches; } // DEFINE FUNCTION convert2inches HERE: int convert2inches(int yards,int feet,int inches) { cout<<"Total inches: "<<total_inches<<; } // DEFINE FUNCTION convert2metric HERE int convert2metric(int total_inches,int meters,centimeters) { centimeters=inches*2.54; meters=centimeters/100; } // DEFINE FUNCTION write_metric_length HERE: int write_metric_length(int meters,int centimeters) { cout<<"Number of Centimeters: "<<centimeters<<; cout<<"Number of Meters: "<<meters<<; cout<<"FOR centimeters (B): "<<centimetersB<<; } Here are the errors from terminal: g++ convert2metric.cpp convert2metric.cpp: In function

Explanation / Answer

Going through the errors one at a time: In function ‘int read_us_length(int, int, int)’: convert2metric.cpp:47: error: expected primary-expression before ‘;’ token convert2metric.cpp:48: error: ‘::main’ must return ‘int’ You mean to say "return 0;" instead of "void main()". The latter makes no sense. convert2metric.cpp:52: error: expected primary-expression before ‘;’ token convert2metric.cpp:53: error: ‘::main’ must return ‘int’ Same as before convert2metric.cpp:57: error: expected primary-expression before ‘;’ token convert2metric.cpp:58: error: ‘::main’ must return ‘int’ Same as before convert2metric.cpp:60: error: expected primary-expression before ‘;’ token Get rid of the last "
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote