PracticeDev/study_cpp/cpp_primer_source_code/Chapter 9/file1.cpp

27 lines
617 B
C++
Raw Normal View History

2022-12-20 17:31:11 +08:00
// file1.cpp -- example of a three-file program
#include <iostream>
#include "coordin.h" // structure templates, function prototypes
using namespace std;
int main()
{
rect rplace;
polar pplace;
cout << "Enter the x and y values: ";
while (cin >> rplace.x >> rplace.y) // slick use of cin
{
pplace = rect_to_polar(rplace);
show_polar(pplace);
cout << "Next two numbers (q to quit): ";
}
cout << "Bye!\n";
// keep window open in MSVC++
/*
cin.clear();
while (cin.get() != '\n')
continue;
cin.get();
*/
return 0;
}