Assignment # 4
Assignment # 4
(Five tasks)
1-Assignment submission date is 14/8/2011,time 11:59pm.
2-You have to follow the CONSTRAINTS in the tasks.
3-There will be possiblity of Quiz in Next coming LAB.
4-This Assignment have solid marks.
5-Those students have any Query about this Assignment can
discuss through mail.
6-Also,Confirm about ur previous assignments submission,on
Monday.
Regards;
NS Y0S0F
AWAN
Best of Luck
TASK 1:
Write a program that input two strings in main() function and passes
the strings to a function name called SEARCH .The function Searchs
string 1 in string 2,and returns true or false.
Sample execution:
Str 1=ali;
Str 1=
Str 2=4ail5lvyiu ;
Str 2=
Search(str 1 , str 2);//function call
Search(string str 1,string str 2){ //Function Defination
return true;//Above function return true b/c str 1 founds in str 2.
}
CONSTRAINTS:
You can use only 1 loop structure,in task 1.More then 1 loop structure
not allow.
String str=;//#include<string>
getline(cin,str);//get input in string
A l i
4 A i l 5 l v y i u
cout<<str;//for output of string
TASK 2:
A C++ Program to capitalize the first character of every word in a
string.
Sample execution:
Input : this task is very easy
Output : This Task Is Very Easy
CONSTRAINTS:
Use class in above task(task 2).
TASK 3:
Write a class Product with three data members Product id, Price
Product name.The program create two objects of the class and
input values for these objects.And program display the most costly
product.
TASK 4:
Write a program that input one strings in main() function and passes
the string to a function name called Reverse .The function Reverses
string ,and returns it.
CONSTRAINTS:
You can use only 1 loop structure,in task 1.More then 1 loop structure
not allow.
TASK 5:
Explain the term Class and Object using the example of a student class. The
student class represents name, enrolment number, fathers name, telephone
number, program code and date of birth of a student. The class has a
function to show the information about the student except date of birth, and
to modify the information of telephone number and program. List the private
and public members (data members as well as member functions) for the
class student. Define the data types of member variables using C++ and
create few objects of the class.