Jan 9 - Return(x*x Squareroot.h => float squareroot(int...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE106 – Jan9 Topic: C++ program organization Int main(){ } Int funct1(….){ …. } …. Void functn(….){ …. } Int squared(int); //function prototype Float squareroot(int); //function prototype Int main (){ Int y,z,w; Float x; Cin>>y; Cin>>z; W=squared(y); Cout<<w<<endl; X=squareroot(z); Cout<<x<<endl; Return 0; } Int squared (int x){ Return(x*x); } Float squareroot(int x){ Return(sqrt(x)); } Deinition file: Squared.h => int squared(int); Implementation file: Squared.cc => Int squared (int x){
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Return(x*x); } Squareroot.h => float squareroot(int); Squareroot.cc => float squareroot(int x){ Return(sqrt(x)); } Myprog.cc => #include <iostream> #include <cmath> #include “squared.h” #include “squareroot.h” int main(){ …… { #ifndef _SQUARED_H // #define _SQUARED_H //squared.h Int squared(int); // #endif // #ifdef v …… #endif #ifndef v …… #endif #define v #undefine v...
View Full Document

This note was uploaded on 04/17/2008 for the course ECE ECE106 taught by Professor Abdelrahman during the Spring '08 term at University of Toronto.

Page1 / 2

Jan 9 - Return(x*x Squareroot.h => float squareroot(int...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online