Created
November 10, 2012 02:54
-
-
Save Jack2/4049662 to your computer and use it in GitHub Desktop.
[C++]float_example (+cin.getline)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdlib> | |
using namespace std; | |
int main() | |
{ | |
char buffer[100]; | |
float price; | |
int quantity; | |
cout << "단가 : "; | |
cin.getline(buffer,100); | |
price = atof(buffer); | |
cout << "수량 : "; | |
cin.getline(buffer,100) ; | |
quantity = atoi(buffer); | |
cout << "가격 : " << price*quantity << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment