PDF Basic Tasks!
PDF Basic Tasks!
Int main()
{
Int x=10;
Cout <<”you are “<<x<<” years old\n”;
Cout <<”you are too young to play the game “
Return 0;
}
#Include<iostream>
Using namespace std;
Int main()
{
Int a ;
Cout <<”size of int = “<<sizeof a<<endl;
Float b ;
Cout <<”size of float = “<<sizeof b <<endl;
Char c ;
Cout <<”size of character = “<<sizeof c<<endl;
Bool d ;
Cout <<”size of bool = “<<sizeof d<<endl;
Return 0;
}
Task.4 Write a C++ program to declare an integer variable Hours and assign
#include<iostream>
Int main()
”minutes”;
Return 0;
}
Task. 5 Write a C++ program to declare two integers, one float variables and
assign 10, 15, and 12.6 to them respectively. It then prints these values on the
screen.
#include<iostream>
Int main()
Int a=10;
Int b=15;
Float c= 12.6;
Task.6 Write three C++ statements to print the asterisk pattern as shown
below.
*****
*****
#include<iostream>
Using namespace std;
Int main()
{
Cout <<”*****”<<endl;
Cout <<”*****”<<endl;
Cout <<”*****”<<endl;
Return 0;
}
Task.7 Write a program in C++ to check the upper and lower limits of
integer.
Task .8 Insert the missing part of the code below to output "Hello World!".
int main() {
<< "Hello World!";
return 0;
}
Cout
Task.9 Insert a new line after "Hello World", by using a special character:
int main() {
cout << "Hello World! ";
cout << "I am learning C++";
return 0;
}
\n
Task.10 Comments in C++ are written with special characters. Insert the missing parts:
//
/*
Task. 11 Fill in the missing parts to create three variables of the same type, using a comma-
separated list:
int x = 5;
int y = 10;
= x + y;
cout <<
Int z; z
Task. 13 Write a program to print the following pattern:
C
i I
s s
b b
e e
s s
tsebsiCisbest
#include<iostream>
Using namespace std;
Int main()
{
Cout <<” c”<<endl;
Cout <<” I I”<<endl;
Cout <<” s s”<<endl;
Cout <<” b b”<<endl;
Cout <<” e e”<<endl;
Cout <<” s s”<<endl;
Cout <<”cisbes.sebsic”<<endl;
Return 0;
}