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

basics of most c programs
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

http://cs.mst.edu

Basics of Most C++ Programs

slide-2
SLIDE 2

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 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. }
slide-3
SLIDE 3

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 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. }
slide-4
SLIDE 4

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 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. }
slide-5
SLIDE 5

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 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. }
slide-6
SLIDE 6

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 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. }
slide-7
SLIDE 7

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 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. }
slide-8
SLIDE 8

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 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. }
slide-9
SLIDE 9

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 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. }
slide-10
SLIDE 10

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 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. }
slide-11
SLIDE 11

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 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. }
slide-12
SLIDE 12

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 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. }
slide-13
SLIDE 13

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 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. }
slide-14
SLIDE 14

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 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. }
slide-15
SLIDE 15

http://cs.mst.edu

End of Session