example01 - char num = "-23"; //...

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

View Full Document Right Arrow Icon
#include <iostream> using namespace std; // PROTOTYPES // no return void askUser(); // int return type int sumXY(int, int); // function declaration float sum(float, float, float); char returnChar(char); bool isNegative(char []); int main(){ int x = 3, y = 3; int a= 4, b = 6; int ans1 = sumXY(a,b); cout << "ans1 = " << ans1 << endl; float s = 1.5, r = 4.5, t = 1.0; float ans2; ans2 = sum(s, r, t); cout << "ans2 = " << ans2 << endl; char letter = 'c'; char ans3; ans3 = returnChar(letter); cout << "ans3 = " << ans3 << endl;
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: char num = &quot;-23&quot;; // num &lt; 0 bool status; //bool answer = true; // status = isNegative(num); if(isNegative(num) == true) cout &lt;&lt; &quot;Negative\n&quot;; else cout &lt;&lt; &quot;False!\n&quot;; return 0; } int sumXY(int a, int b){ int total; total = a+b; return total; //return (a + b); } float sum(float a, float b, float c){ return (a+b+c); } char returnChar(char a){ return a; } bool isNegative(char a){ if(a[0] == '-') return true; else return false; }...
View Full Document

This note was uploaded on 03/30/2011 for the course ENGINEERIN 127 taught by Professor Finch during the Spring '08 term at Rutgers.

Page1 / 2

example01 - char num = &amp;amp;quot;-23&amp;amp;quot;; //...

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