|
|
|
|
I compiled your code using MSVC2012 and it ran perfectly. I'm not very familiar with mac compilers but the first thing you should try is cleaning your project. Sometimes the compiler can get confused over things like time stamps and wont compile everything. Cleaning the project will cause the program to recompile completely the next time you build it. |
#include <iostream> // using namespace std; int main () { float a; float b; float c; float d; // float acmid; // float bdmid; std::cout << "This program will find the midpoint (x,y) for points (a,b) and (c,d). \n"; //x coor for point (a,b) std::cout << "Enter the value for a: "; std::cin >> a; // cout << "\n"; //y coor for point (a,b) std::cout << "Enter the value for b: "; std::cin >> b; // cout << "\n"; //x coor for point (c,d) std::cout << "Enter the value for c: "; std::cin >> c; // cout << "\n"; //y coor for point (c,d) std::cout << "Enter the value for d: "; std::cin >> d; // cout << "\n"; const float acmid = (a+c)/2; const float bdmid = (b+d)/2; std::cout << "The midpoint (x,y) is: \n" << "x = " << acmid << '\n' << "y = " << bdmid << '\n' ; //return 0; } |
What value are you trying to input for a? |
std
. cin
provided by the library is std::cin
and cout
is std::cout
const float
is like a normal float
, except that after it is initialized, its value can't be changed.