basics of most c programs
play

Basics of Most C++ Programs http://cs.mst.edu 01. // Programmer: - PowerPoint PPT Presentation

Basics of Most C++ Programs http://cs.mst.edu 01. // Programmer: Clayton Price date: 9/4/10 02. // File: fahr2celc.cpp 03. // Purpose: this file contains the main function of the program which will input 04. // Fahrenheit


  1. Basics of Most C++ Programs http://cs.mst.edu

  2. 01. // Programmer: Clayton Price date: 9/4/10 02. // File: fahr2celc.cpp 03. // Purpose: this file contains the main function of the program which will input 04. // Fahrenheit temps from the user, then convert and output Celsius to same. 05. 06. #include <iostream> 07. using namespace std; 08. 09. int main() 10. { 11. /* ------------------------- DECLARATIONS ---------------------------- */ 12. float celc; // output variable 13. float fahr; // input variable 14. 15. /* -------------------- GREETINGS AND INPUT ----------------------- */ 16. cout <<” \t\tWelcome to Temperature Conversion Program”<< endl<<endl; 17. cout <<”Please enter a temperature in Fahrenheit: “; 18. cin>>fahr; 19. 20. /* --------------------- COMPUTATIONS AND OUTPUT ---------- */ 21. celc = (5.0/9)*(fahr – 32); 22. cout <<” \n\nYour temperature input of “<< fahr <<” degrees Fahrenheit is “ 23. << celc <<” degrees celcius ”<< endl; 24. cout <<”Have a nice day”<< endl; 25. 26. return 0; 27. } http://cs.mst.edu

  3. 01. // Programmer: Clayton Price date: 9/4/10 02. // File: fahr2celc.cpp 03. // Purpose: this file contains the main function of the program which will input 04. // Fahrenheit temps from the user, then convert and output Celsius to same. 05. 06. #include <iostream> 07. using namespace std; 08. 09. int main() 10. { 11. /* ------------------------- DECLARATIONS ---------------------------- */ 12. float celc; // output variable 13. float fahr; // input variable 14. 15. /* -------------------- GREETINGS AND INPUT ----------------------- */ 16. cout <<” \t\tWelcome to Temperature Conversion Program”<< endl<<endl; 17. cout <<”Please enter a temperature in Fahrenheit: “; 18. cin>>fahr; 19. 20. /* --------------------- COMPUTATIONS AND OUTPUT ---------- */ 21. celc = (5.0/9)*(fahr – 32); 22. cout <<” \n\nYour temperature input of “<< fahr <<” degrees Fahrenheit is “ 23. << celc <<” degrees celcius ”<< endl; 24. cout <<”Have a nice day”<< endl; 25. 26. return 0; 27. } http://cs.mst.edu

  4. 01. // Programmer: Clayton Price date: 9/4/10 02. // File: fahr2celc.cpp 03. // Purpose: this file contains the main function of the program which will input 04. // Fahrenheit temps from the user, then convert and output Celsius to same. 05. 06. #include <iostream> 07. using namespace std; 08. 09. int main() 10. { 11. /* ------------------------- DECLARATIONS ---------------------------- */ 12. float celc; // output variable 13. float fahr; // input variable 14. 15. /* -------------------- GREETINGS AND INPUT ----------------------- */ 16. cout <<” \t\tWelcome to Temperature Conversion Program”<< endl<<endl; 17. cout <<”Please enter a temperature in Fahrenheit: “; 18. cin>>fahr; 19. 20. /* --------------------- COMPUTATIONS AND OUTPUT ---------- */ 21. celc = (5.0/9)*(fahr – 32); 22. cout <<” \n\nYour temperature input of “<< fahr <<” degrees Fahrenheit is “ 23. << celc <<” degrees celcius ”<< endl; 24. cout <<”Have a nice day”<< endl; 25. 26. return 0; 27. } http://cs.mst.edu

  5. 01. // Programmer: Clayton Price date: 9/4/10 02. // File: fahr2celc.cpp 03. // Purpose: this file contains the main function of the program which will input 04. // Fahrenheit temps from the user, then convert and output Celsius to same. 05. 06. #include <iostream> 07. using namespace std; 08. 09. int main() 10. { 11. /* ------------------------- DECLARATIONS ---------------------------- */ 12. float celc; // output variable 13. float fahr; // input variable 14. 15. /* -------------------- GREETINGS AND INPUT ----------------------- */ 16. cout <<” \t\tWelcome to Temperature Conversion Program”<< endl<<endl; 17. cout <<”Please enter a temperature in Fahrenheit: “; 18. cin>>fahr; 19. 20. /* --------------------- COMPUTATIONS AND OUTPUT ---------- */ 21. celc = (5.0/9)*(fahr – 32); 22. cout <<” \n\nYour temperature input of “<< fahr <<” degrees Fahrenheit is “ 23. << celc <<” degrees celcius ”<< endl; 24. cout <<”Have a nice day”<< endl; 25. 26. return 0; 27. } http://cs.mst.edu

  6. 01. // Programmer: Clayton Price date: 9/4/10 02. // File: fahr2celc.cpp 03. // Purpose: this file contains the main function of the program which will input 04. // Fahrenheit temps from the user, then convert and output Celsius to same. 05. 06. #include <iostream> 07. using namespace std; 08. 09. int main() 10. { 11. /* ------------------------- DECLARATIONS ---------------------------- */ 12. float celc; // output variable 13. float fahr; // input variable 14. 15. /* -------------------- GREETINGS AND INPUT ----------------------- */ 16. cout <<” \t\tWelcome to Temperature Conversion Program”<< endl<<endl; 17. cout <<”Please enter a temperature in Fahrenheit: “; 18. cin>>fahr; 19. 20. /* --------------------- COMPUTATIONS AND OUTPUT ---------- */ 21. celc = (5.0/9)*(fahr – 32); 22. cout <<” \n\nYour temperature input of “<< fahr <<” degrees Fahrenheit is “ 23. << celc <<” degrees celcius ”<< endl; 24. cout <<”Have a nice day”<< endl; 25. 26. return 0; 27. } http://cs.mst.edu

  7. 01. // Programmer: Clayton Price date: 9/4/10 02. // File: fahr2celc.cpp 03. // Purpose: this file contains the main function of the program which will input 04. // Fahrenheit temps from the user, then convert and output Celsius to same. 05. 06. #include <iostream> 07. using namespace std; 08. 09. int main() 10. { 11. /* ------------------------- DECLARATIONS ---------------------------- */ 12. float celc; // output variable 13. float fahr; // input variable 14. 15. /* -------------------- GREETINGS AND INPUT ----------------------- */ 16. cout <<” \t\tWelcome to Temperature Conversion Program”<< endl<<endl; 17. cout <<”Please enter a temperature in Fahrenheit: “; 18. cin>>fahr; 19. 20. /* --------------------- COMPUTATIONS AND OUTPUT ---------- */ 21. celc = (5.0/9)*(fahr – 32); 22. cout <<” \n\nYour temperature input of “<< fahr <<” degrees Fahrenheit is “ 23. << celc <<” degrees celcius ”<< endl; 24. cout <<”Have a nice day”<< endl; 25. 26. return 0; 27. } http://cs.mst.edu

  8. 01. // Programmer: Clayton Price date: 9/4/10 02. // File: fahr2celc.cpp 03. // Purpose: this file contains the main function of the program which will input 04. // Fahrenheit temps from the user, then convert and output Celsius to same. 05. 06. #include <iostream> 07. using namespace std; 08. 09. int main() 10. { 11. /* ------------------------- DECLARATIONS ---------------------------- */ 12. float celc; // output variable 13. float fahr; // input variable 14. 15. /* -------------------- GREETINGS AND INPUT ----------------------- */ 16. cout <<” \t\tWelcome to Temperature Conversion Program”<< endl<<endl; 17. cout <<”Please enter a temperature in Fahrenheit: “; 18. cin>>fahr; 19. 20. /* --------------------- COMPUTATIONS AND OUTPUT ---------- */ 21. celc = (5.0/9)*(fahr – 32); 22. cout <<” \n\nYour temperature input of “<< fahr <<” degrees Fahrenheit is “ 23. << celc <<” degrees celcius ”<< endl; 24. cout <<”Have a nice day”<< endl; 25. 26. return 0; 27. } http://cs.mst.edu

  9. 01. // Programmer: Clayton Price date: 9/4/10 02. // File: fahr2celc.cpp 03. // Purpose: this file contains the main function of the program which will input 04. // Fahrenheit temps from the user, then convert and output Celsius to same. 05. 06. #include <iostream> 07. using namespace std; 08. 09. int main() 10. { 11. /* ------------------------- DECLARATIONS ---------------------------- */ 12. float celc; // output variable 13. float fahr; // input variable 14. 15. /* -------------------- GREETINGS AND INPUT ----------------------- */ 16. cout <<” \t\tWelcome to Temperature Conversion Program”<< endl<<endl; 17. cout <<”Please enter a temperature in Fahrenheit: “; 18. cin>>fahr; 19. 20. /* --------------------- COMPUTATIONS AND OUTPUT ---------- */ 21. celc = (5.0/9)*(fahr – 32); 22. cout <<” \n\nYour temperature input of “<< fahr <<” degrees Fahrenheit is “ 23. << celc <<” degrees celcius ”<< endl; 24. cout <<”Have a nice day”<< endl; 25. 26. return 0; 27. } http://cs.mst.edu

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend