C++_Sample_Function - If(isneg == true cout<<"The...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 #include <iostream> using namespace std //PROTOTYPES: void askUser() //no return int sumXY(int, int) float sum(float, float, float) char returnChar(char) bool isNegative(char[]) //END OF PROTOTYPES int main() { int x=3, y=3 int ans = sumXY(x,y) float s= 1.5, r=4.5, t=1.0 float ans2 ans2 = sum(s, r, t) char letter = 'c' char ans3 ans3 = returnChar(letter) char num[] = "-23" //num < 0 WILL NOT WORK bool isneg = isNegative(num)
Background image of page 1

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

View Full Document Right 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: If (isneg == true) cout<< "The number is negative. \n" else cout<< "The number is NOT negative. \n" return } int sumXY(int a, int b) { int total total = a+b return total r } float sum(float a, float b, float c) { return (a+b+c) } char returnChar(char a) { return a } bool isNegative(chara) { if (a[0]) == '-') return true else Sheet1 Page 2 return false }...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

C++_Sample_Function - If(isneg == true cout<<"The...

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