You are on page 1of 4

Glenn Gutierrez 12

CST 2403-E339

H/W #2

Prof: Elhari Sept 27, 13


1. Data types and their ranges.

Type Name Range of Values


Int -2,147,483,648 to 2,147,483,647
Unsigned 0 to 4,294,967,295
_int16 -32,728 to 32,767
_int32 -2,147,483,648 to 2,147,483,647
Long -2,147,483,648 to 2,147,483,647
Short -32,768 to 32,767
_int64 -9,223,372,036,854,775,808 to
9,223,372,036,854,775,807
Bool False or True

2. Write a C++ program with your name and address.

#include <iostream>
//ggprog2
//Write a c++ to print your name and adress
using namespace std;

int main()
{
cout<< "Glenn Gutierrez \n";
cout<< "2325 University Avenue Apt 4D \n";
cout<< "Bronx, NY 10468";
cout<<"\n";
system ("pause");

return 0;

}
3. Write a C++ program to print the sum of 5 and 9.

#include <iostream>
//ggprog3
//To print the sum of 5 0 9
using namespace std;

int main()

{
cout<<"9+5="<<9+5<<endl;
system ("pause");

return 0;
}

4. Write a C++ program to print 5+9=14.

//ggprog4
//To print 5+9=14
#include <iostream>

using namespace std;

int main()
{
cout<< "5+9="<<5+9endl;
cout<<"\n";
system ("pause");

return 0;

}
5. Write a C++ program to print the sum of 5 and 9 using variables.

#include <iostream>
//ggprog5
//Print the sum of 5,9 using variables
using namespace std;

int main()
{
int num1,num2,sum;
num1=5;
num2=9;
sum=num1+num2;
cout<<" The sum is "<< sum <<endl;
cout<<"\n";
system ("pause");

return 0;
}

6. Write a C++ program to print the sum of 5 and 9 using cin.

#include <iostream>
//ggprog6
//Print the sum of 5,9 using cin
using namespace std;

int main()
{
int a,b,sum;
cout<< "Enter first number: ";
cin>>a;
cout<< "Enter second number: ";
cin>>b;
sum a+b
cout<< " The sum of " << a << " and " << b >> sum<<endl;
system ("pause");

return 0;
}

You might also like