Lab 02 Solution
Lab 02 Solution
Suppose your full name is Ahsan Nazeer hence, your first name is Ahsan which
contains five characters.
12 34 5
Solution (a)
// Suppose name is Ahsan Nazeer
#include <iostream> using
namespace std;
int main ()
{
cout<<"1 2 \t 3 4 \t 5 \n" ;
system("pause");
return 0;
}
Solution (b)
// Suppose name is Ahsan Nazeer
#include <iostream> using
namespace std;
int main ()
{
cout<<"1" ;
cout<<" 2" ; cout
<<"\t 3" ;
cout<<" 4" ;
cout<<"\t 5 \n" ;
system("pause");
return 0;
}
Solution (c)
// Suppose name is Ahsan Nazeer
#include <iostream>
#include <stdlib.h> using
namespace std;
int main ()
{
cout<<"1" <<" 2" <<"\t 3" <<" 4" <<"\t 5 \n" ;
system ("PAUSE") ;
return 0;
}
Solution:
#include <iostream> using
namespace std;
int main ()
{
cout<<"\t \t \t \t \t poem \n" ;
cout<<"\t \t \t I wandered lonely as a cloud \n" ; cout<<"\t \t \t That floats on
high o'er vales and hills \n" ; cout<<"\t \t \t When all at once I saw a crowd \n"
; cout<<"\t \t \t A host, of golden daffodils \n" ; cout<<"\t \t \t Beside the
lake, beneath the trees \n" ; cout<<"\t \t \t Fluttering and dancing in the
breeze \n\n\n\n\n\n\n\n\n\n" ; system ("PAUSE") ;
return 0;
}
Solution (Arrow)