LAB 1.1 & 1.2 LAB EXERCISES 1. Use four cout statements to print the pattern of asterisks shown * ** *** **** 2. Write a program that produces the following output: CCCCCCCCC ++ ++ CC ++ ++ CC ++++++++++++++ ++++++++++++++ CC ++++++++++++++ ++++++++++++++ CC ++ ++ CCCCCCCCC ++ ++ 3. Create a program that allow user to enter the numbers and this programs will prints the numbers vertically. 4. Create a program that allow user to enter 10 numbers and this program will prints the first and the last one on one line, the second and the ninth on the next line, the third and the seventh on the next line and so forth.
ANSWER Question 1: source code /* Author : xxx Description: Lab 1.1 & 1.2 Date : 3 January 2008 */ #include #include void main () {//open main cout<<"*"<<endl; cout<<"**"<<endl; cout<<"***"<<endl; cout<<"****"<<endl<<endl; system ("pause"); }//end main console application
Question 2: source code /* Author : xxx Description: Lab 1.1 & 1.2 Date : 3 January 2008 */ #include #include void main () {//open main
system ("pause"); }//end main console application
Question 3: source code /* Author : xxx Description: Lab 1.1 & 1.2 Date : 3 January 2008 */ #include #include void main () {//open main float num1,num2,num3,num4,num5; //get input cout<<"\nEnter Number:"; cin>>num1; cout<<"\nEnter Number:"; cin>>num2; cout<<"\nEnter Number:"; cin>>num3; cout<<"\nEnter Number:"; cin>>num4; cout<<"\nEnter Number:"; cin>>num5; //print output cout<<"\n....................."<<endl<<endl; cout<
console application
Question 4: source code /* Author : xxx Description: Lab 1.1 & 1.2 Date : 3 January 2008 */ #include #include void main() {//open main float num1,num2,num3,num4,num5,num6,num7,num8,num9,num10; //get input cout<<"\nEnter Number:"; cin>>num1; cout<<"\nEnter Number:"; cin>>num2; cout<<"\nEnter Number:"; cin>>num3; cout<<"\nEnter Number:"; cin>>num4; cout<<"\nEnter Number:"; cin>>num5; cout<<"\nEnter Number:"; cin>>num6; cout<<"\nEnter Number:"; cin>>num7; cout<<"\nEnter Number:"; cin>>num8; cout<<"\nEnter Number:"; cin>>num9; cout<<"\nEnter Number:"; cin>>num10;
//show output cout<<"\n..........................."<<endl<<endl; cout<
Related Documents
More Documents from ""