Question

This is a C++ Program I created in Visual Studio for class. The problem I am...

This is a C++ Program I created in Visual Studio for class. The problem I am having is I get an error msg that says, "no matching token found for line 8." What am I missing? I see an opening bracket and a closing bracket. But, the program will not build because it says more or less the bracket is missing.

FYI....Line 8, is the bracket directly under int main (). Can someone help me understand where I am going wrong?

#include <iostream>
#include <iomanip>
using namespace std;

   double FallingDistance(double);

   int main()
   {
       double Seconds = 1;
       double Distance = 0;
       cout << "Seconds Distance\n";
       cout << "==================\n";


       for (double Seconds = 1; Seconds < 12; Seconds = Seconds + 1)
       {

           Distance = FallingDistance(Seconds);

           cout << Seconds << " " << FallingDistance << endl;
       }
   }
  

   { double FallingDistance (double Seconds);
  
   double Distance = .5 * 32.2 * Seconds * Seconds;
   return 0;

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <iostream>
#include <iomanip>
using namespace std;

double FallingDistance(double);

int main()
{
   double Seconds = 1;
   double Distance = 0;
   cout << "Seconds Distance\n";
   cout << "==================\n";


   for (double Seconds = 1; Seconds < 12; Seconds = Seconds + 1)
   {

      Distance = FallingDistance(Seconds);

      cout << Seconds << " " << FallingDistance << endl;
   }
}


double FallingDistance(double Seconds){
   double Distance = .5 * 32.2 * Seconds * Seconds;
   return Distance;
}
Add a comment
Know the answer?
Add Answer to:
This is a C++ Program I created in Visual Studio for class. The problem I am...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ problem. hi heys, i am trying to remove beginning and the end whitespace in one...

    C++ problem. hi heys, i am trying to remove beginning and the end whitespace in one file, and output the result to another file. But i am confused about how to remove whitespace. i need to make a function to do it. It should use string, anyone can help me ? here is my code. #include <iostream> #include <iomanip> #include <cstdlib> #include <fstream> using namespace std; void IsFileName(string filename); int main(int argc, char const *argv[]) { string inputfileName = argv[1];...

  • I am using C++ Start with the distance.cpp file on the website. Fill in the missing...

    I am using C++ Start with the distance.cpp file on the website. Fill in the missing functions to enable the program to compile and correctly find determine which entered distance is larger. The user can either enter it in meters labeled with an “m”, or in feet and inches labeled with and ' and “. You may not change main(), we will check to ensure it is exactly the same. The meters and inches can be doubles, but the feet...

  • My C++ program is not compiling. Please explain how you fixed with detailed inline comments. I am using Visual Studio 2017. It's a character count program that keeps and displays a count of all th...

    My C++ program is not compiling. Please explain how you fixed with detailed inline comments. I am using Visual Studio 2017. It's a character count program that keeps and displays a count of all the upper, lower case and digits in a .txt file. The requirement is to use classes to implement it. -----------------------------------------------------------------HEADER FILE - Text.h--------------------------------------------------------------------------------------------- /* Header file contains only the class declarations and method prototypes. Comple class definitions will be in the class file.*/ #ifndef TEXT_H #define...

  • I am having trouble figuring out why my program will not make any columns, just rows....

    I am having trouble figuring out why my program will not make any columns, just rows. I need to display a square. The instructions are provided below. (This for my C++ class) Write a program that displays a square. Ask the user for the square’s size. Only accept positive integer numbers (meaning choose a data type that holds positive integer values). The size the user gives you will determine the length and width of the square. The program should then...

  • I am trying to run this program in Visual Studio 2017. I keep getting this build...

    I am trying to run this program in Visual Studio 2017. I keep getting this build error: error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". 1>Done building project "ConsoleApplication2.vcxproj" -- FAILED. #include <iostream> #include<cstdlib> #include<fstream> #include<string> using namespace std; void showChoices() { cout << "\nMAIN MENU" << endl; cout << "1: Addition...

  • Hey, so i am trying to have my program read a text file using a structure...

    Hey, so i am trying to have my program read a text file using a structure but i also want to be able to modify the results(I kinda have this part but it could be better). I cant seem to get it to read the file(all the values come up as 0 and i'm not sure why because in my other program where it wrote to the txt file the values are on the txt file) i copied and pasted...

  • Need to write a program in Visual Studio CLR CONSOL APPLICATION for date of birth ,...

    Need to write a program in Visual Studio CLR CONSOL APPLICATION for date of birth , addition , substraction . After perfoming additon, there should be an statement " do you wish to continue ? Press Yes to continue or E to exit. Once YES is pressed , then substraction followed by date of birth. If exit is presses then the screen should get closed. i have written a program , so please update that #include "stdafx.h" # include <iostream>...

  • 1. What is wrong with the following C++ program? #include <iostream> int main() { a =...

    1. What is wrong with the following C++ program? #include <iostream> int main() { a = 4; b = 6; cout << a << "+" << b << "=" << a+b; return 0; 2. What is wrong with the following C++ program? What was its intended output? #include <iostream> using namespace std; int main() { cout << "What is larger? e pi or pi e?" << endl; double ans1 = exp(pi); double ans2 = pi exp(1.); cout << "epi is...

  • PLEASE TYPE OUT IN TEXT (please no pdf or writing) C++ CODE Consider the following program...

    PLEASE TYPE OUT IN TEXT (please no pdf or writing) C++ CODE Consider the following program in which the statements are in the incorrect order. Rearrange the statements in the following order so that the program prompts the user to input: The height of the base of a cylinder The radius of the base of a cylinder The program then outputs (in order): The volume of the cylinder. The surface area of the cylinder Format the output to two decimal...

  • Consider the following program in which the statements are in the incorrect order. Rearrange the statements...

    Consider the following program in which the statements are in the incorrect order. Rearrange the statements so that the program prompts the user to input the height and the radius of the base of a cylinder and outputs the volume and surface area of the cylinder. Formant the output to two decimal places. #include <iomanip> #include <cmath> int main () {} double height; cout << ”Volume of the cylinder = “ <<PI * pow(radius, 2.0) * height << endl; cout...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT