Question

k2m.cpp Write a program which converts kilometers to miles and miles to kilometers. Input value (m...

k2m.cpp  

Write a program which converts kilometers to miles and miles to kilometers.

Input value (m or km)is in argv[1]

Program is accessed by "k2m" or "m2k", using Unix' ability to assign
SYMBOLIC LINKS to files, so they have multiple names.
The program knows to do kilometers -> or miles -> km by examining its 
name in argv[0].

(It does a string comparison on argv[0]).

Miles to kilometers:

m2k

Kilometers to miles:

k2m

If you're developing on a Windows machine (no Symbolic Links), just
copy the compiled *.EXE file to the other name.

copy k2m.exe m2k.exe

That way, each program can know what it is doing by looking at its name.

The math:

1 kilometer equals 0.62137 miles.
0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
k2m.cpp Write a program which converts kilometers to miles and miles to kilometers. Input value (m...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT