Skip to content

Commit

Permalink
On to functions.
Browse files Browse the repository at this point in the history
This is an exercise to learn how to use functions.
  • Loading branch information
OctavioIRG committed Oct 26, 2015
1 parent 13d1ca3 commit 12a3c82
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions WSQ-s/onto.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <iostream>
using namespace std;

int uno, dos;

int suma (int a, int b)
{
return (a)+(b);
}
int resta (int a, int b)
{
return (a)+(b);
}
int div (int a, int b)
{
return (a)/(b);
}
int mult (int a, int b)
{
return (a)*(b);
}

int main()
{
cout << "Ingrese dos números enteros positivos" <<endl;
cout << "Número 1" << endl;
cin>> uno;
cout << "Número 2" << endl;
cin>> dos;
if (uno < 0 || dos < 0)
cout <<"Sólo números enteros positivos.";
cout<< suma (uno, dos);
return 0;
}

0 comments on commit 12a3c82

Please sign in to comment.