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];...

  • Can someone help me . This program needs to run in visual studio and written in...

    Can someone help me . This program needs to run in visual studio and written in c++. I want to call to the function string eraseChar in the main function to use the variables str and ch. I cannot use global variables. #include<iostream> #include <string> using namespace std; string eraseChar(char ch = 'e', string str = "the bike fell in the water");    int main() {    int pos;    pos = str.find(ch);    while (pos != string::npos)    {...

  • 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...

  • C++ I am using visual studio for it. Make a copy of the Rational class you...

    C++ I am using visual studio for it. Make a copy of the Rational class you created in the previous Lab. Modify the class. Replace all your mathematical, input, and output functions with overloaded operators. Overload the following 12 operators: + - * / < > = = ! = <= >= >> << In order to test your class in your main function, prompt the user for a numerator and a denominator for your first object. Repeat the prompt...

  • Hello. I am using Visual Studio 2019 and am not sure why it is telling me...

    Hello. I am using Visual Studio 2019 and am not sure why it is telling me I have 5 errors when I BUILD my code in C++. Can someone please take a look? #include using namespace std; int main() { int number_of_quarters, total_value_of_quarters; int number_of_dimes, total_value_of_dimes; int number_of_nickels, total_value_of_nickels; int number_of_pennies, total_value_of_pennies; int total_value_of_coins, total_dollars, total_cents; cout<<"Please enter the # of quarters: "<>number_of_quarters; cout<<"Please enter the # of dimes: "<>number_of_dimes; cout<<"Please enter the # of nickels: "<>number_of_nickels; cout<<"Please enter the...

  • 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 working on this switch program everything seems to be ok but the compiler is...

    I am working on this switch program everything seems to be ok but the compiler is giving me an error on the final closing brace and wanted to know where I am making an error #include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { int choice; char repeat; double MidTerm = 0; double FinalExam = 0; double Quiz1 = 0; double Quiz2 = 0; double MidTermGrade = 1, FinalExamGrade = 2, Quiz1Grade = 3, Quiz2Grade = 4,...

  • C++ How to find the smallest number of 5. A simple program but i am still...

    C++ How to find the smallest number of 5. A simple program but i am still a beginner. With the code i already have, i have found the largest. I am unaware of what to initialize smallest to because the answer comes out as 0 even when there is no 0. Code so far: #include <iostream> using namespace std; int main() {    int numbers;    int largest = 0;    int smallest;    cout << "Enter 5 numbers.";   ...

  • 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 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...

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