Acrux~Alpha 1 Crucis~HR 4730~HD 108248~320.00
Achird~Eta Cassiopeiae~HR 219~HD 4614~19.41
Ain Al Rami~Nu 1 Sagittarii~HR 7116~HD 174974~1850.59
I want to display it as output like:
Name~Proper Name~HR number~HD number~distance
so it will be like Name: Acrux Proper Name: Alpha 1 Crucis HR number: HR 4730 HD number: HD 108248 distance: 320.00
How do I write in C++ code where it will give me desired output. As you can see in the file it is separated by "~" so it means I have to tell the struct method or else what is before 1st ~ and what is before 2nd ~.
any help?
Hi, thanks for helping me in the code. I need a little bit of more guidance.
I have to write a program and the sample runs is like this:
> g++ -o star stars.cpp -std=c++17
> star
Enter file name >> starData.txt
Enter star proper name >> Alpha Cephei
Star: proper name: Alpha Cephei distance: 49.05 light years HD num: HD 203280
HR num HR 8162 common name: Alderaimin
> star
Enter file name >> starData.txt
Enter star proper name >> Alpha Centuri
No star with the proper name "Alpha Centuri" was found
> star
Enter file name >> e.dat
The file "e.dat" does not exist
I think you would be well advised to create a struct Star to hold all the properties of a star.
Then create a vector<Star> and read all your star data into it.
Then you can compare successive inputs from the user with the relevant property of your stars.