It's A Request As Your Teacher and Elder Brother To All of You Guys To Please Please Do It by Yourself
It's A Request As Your Teacher and Elder Brother To All of You Guys To Please Please Do It by Yourself
It's A Request As Your Teacher and Elder Brother To All of You Guys To Please Please Do It by Yourself
Students I hope you all are doing great. This is not an Assignment, it’s a practice
especially for all new beginner of C++, before they will appear in Final Exam. It’s
a request as your teacher and elder brother to all of you guys to please please
do it by yourself. Read Book first about the concept then make pseudocode
which you think is feasible and then try to write the code.
Task 1: Expression to Check: Please solve the expression first on your notebook and write
expected value and then try to code it on C++ IDE to check your Answer, if you Answer does not
match then try to find the Answer.
int x=s.size();
cout<<x<<endl;
int arr[3][3]={{1,30,10},{10,4,25},{3,5,8}}
cout<<(arr[2][1])<<endl;
cout<< (arr[1][2])<<endl;
cout<< (arr[1][1]+arr[2][2]+arr[3][3]);
arr[2][2]=40;
for( int i=0;i<3;i++)
{
for( int j=0;j<3;j++)
{
Cout<<arr[i][j]<<endl;}}}
Int arr[2][2]={{1,2},{‘a’,’d’}}
arr[1][1]=’B’;
arr[1][0]=’A’;
for(int i=0;i<2;i++)
{
for( int j=0;j<2;j++)
{
Cout<<arr[i][j]<<endl;}}}
char arr[3]={‘A’, ‘B’}
for ( int i=0;i<2;i++)
{
arr[i]=arr[i]-arr[i];
cout<<arr[i]}}
int main()
{
int i=1,j;
while(i<=5)
{
j=1;
while(j<=i)
{ cout<<j;
j++; }
cout<<endl;
i++;}};
#include<iostream>
using namespace std;
int main()
{for(int i=7;i>=1;i--)
{ for(int j=1;j<=i;j++)
{
cout<<"*";}
cout<<endl;
}}
int main()
{for(int i=7;i>=1;i--)
{ int k=7;
for(int j=1;j<i;j++)
{
cout<<" ";}
while(k>=i)
{
cout<<"*";
k--;}
cout<<endl;}}
Subjective Tasks: Please read from book about the concept carefully before
attempting the assignment subjective part.
Task1: Write a program in which a father wants to know the grade of his two sons. Ask the user
for the marks. If the marks are greater than 90 then he/she receives A grade. If his first son gets
an A grade, then he will be given a treat by his father. If the second son gets an A grade, then he
would be given a treat by his father. If both sons get A grade, then both will get a treat from
their father. Use nested if-else to do this task.
Task2: Write a C++ program to get input of two integers and then apply all bitwise operators on
them and produce the output of operations on the screen along with performed operation
string. E.g. “Result of (x & y) = result”. ( Hint : Please apply the following bitwise operators and,
or, XOR, only)
Task3: Write a C++ Program using Switch case statements that will take input from user his
name, father name, and then roll.no. and then marks of Matric and FSC and then program will
calculate the percentage and will print of all these details. Percentage should be in float data
types. (Add String Pre-processive directives at the start if necessary)
Task 4: Write a C++ program to convert a given user defined number into Scientific Notation.
Just like if the user enters 87690 then the answer should be 8.769 * 104 and if the user enters
86.790 at runtime then the output should be 8.679 * 101.
Task 5: Write a C++ Program which will request 5 integer values from the user. It should then
print one of these two things
Task 6: Write a C++ program that requests five integer values from the user. It then prints the
maximum and minimum values entered. If the user enters the values 3, 2, 5, 0, and 1, the
program would indicate that 5 is the maximum and 0 is the minimum. Your program should
handle ties properly; for example, if the user enters 2, 4 2, 3 and 3, the program should report 2
as the minimum and 4 as maximum. (Hint: Please do not use Arrays for this, use only nested
if-else
Task 7: Write a C++ program which will print a ‘O’ series from 1 to entered number. In a loop
when the number is multiple of 5 , it should print exact number of zeros. Otherwise it should
print an ‘O’ as mentioned below
Task8: Write a C++ Code that tells the user that entered string is a palindrome r or not.
Palindrome is a word that is same when reversed e.g. abba , redivider.
Task 09: Write a C++ Code to count number of word in the user defined entered string. Like
user entered string as “Introduction to IT Course” so the output will be the number of words
will be 4.
Task 10: ROT13 is a week encryption that involves “rotating “each letter in a word by 13 places.
To rotate a letter means shifting it through the alphabet wrapping around to the beginning of if
necessary, so A is shifted by 3 is ‘D’ and ‘Z’ shifted by 1 is ‘A’. Write a C++ Program that
demonstrate string encryption with ROT13(You can also define your own logic for start and end
alphabets encryption)
Task11: Write a C++ Program to that would print below mentioned Shape
Task 12: Write a function in C++ Platform that will print a star (*) pattern of first alphabet of
your name. like for Faiza. The function would print * patter of F
Task 13: Write a C++ Code that should pair arrays of Integers.
{(1,2),(2,3),(3,4)}
Task 14: write a C++ Function that will display sum of following series in the output
((1+1) *2) +((2+3) *4) +((3+5) *8) +((4+7) *16) +((5+9) *32) ……………. (((n+1) + (n+2))*n2)
Task 15: Write a Function using C++ Platform that will count the number of times each alphabet
appears. Like for “Class level” (s appears 2 time, e appears 2 times, l appear 3 times and rest
appears 1 time)
Task 16: Given an Email address as an argument to a function, extract user name and domain
name.
Task 17: Write a function in C++ that will take two integers (Must be integers) as an argument
and calculate its LCM. (Least common Multiple). The Function should return a value to main
function.
Task 18: Write a C++ Function that Calculate transpose of a 2 D Array (Matrix)
Transpose of a Matrix means to change rows into columns or columns into rows like mentioned
below
Similarly, the transpose of same order matrix will be of same order just like below
Note: Please don’t stop at this assignment. Read multiple books and my lectures or any other
source to understand the C++ concepts till functions.
First make Pseudocode, Dry run and then try to code on IDE (Integrated Development
Environment) editor ( Like Dev C++ or Visual Studio etc.).
Please work hard as I always say that learning means to work hard, to make mistakes, to take
pain but at the end, one reward that you will get is SUCCESS!!!!!!!
Best of luck ☺