Originally Posted by
blimsiang
Hi guys~
I require an input that will accept a measurement in feet and pounds, i.e.
5'6
So I have this so far:
Code:
cout << "Enter your height: " ;
float x, y ;
cin >> x >> y;
However, my programme is unable to read the apostrophe.
Any hints?
You read two float numbers. You should read a float, a character (the apostrophe) and a float number. Try that. I guess it reads only the 5 eh?
EDIT: Some code:
Code:
#include <iostream>
using namespace std;
int main(void)
{
float x, y;
char c;
cin >> x >> c >> y;
cout << x << " " << y;
}