5
======================================= = DeVry College of New York COMP 220 Lab #5: Pointers and Pointer Operations C++ Name – DSI – June 05, 2014 Objective: Write a program that asks the user to enter the temperature in Celsius. Convert the temperature to Fahrenheit and display it on the screen. Tools required : PC & Visual studio software Code: #include <iostream> #include "Resistor.h" using namespace std; void sort(Resistor *res[], int leng) { Resistor tem; for ( int out=leng-1; out>1; out--) for ( int in=0; in<out; in++) if ( res[in]->getResistance() > res[in+1]->getResistance() ) { tem=*res[in]; *res[in]=*res[in+1]; *res[in+1]=tem; }

COMP 220 Lab Week5

  • Upload
    lu

  • View
    7

  • Download
    3

Embed Size (px)

DESCRIPTION

C++ codes

Citation preview

========================================DeVry College of New YorkCOMP 220Lab #5: Pointers and Pointer Operations C++

Name DSI June 05, 2014

Objective: Write a program that asks the user to enter the temperature in Celsius. Convert the temperature to Fahrenheit and display it on the screen.Tools required: PC & Visual studio software

Code:#include#include"Resistor.h"using namespace std;void sort(Resistor *res[],int leng){Resistor tem;for(int out=leng-1; out>1; out--) for(int in=0; ingetResistance() > res[in+1]->getResistance() ) { tem=*res[in]; *res[in]=*res[in+1]; *res[in+1]=tem; } }int main(){Resistor *resistors[10];cout