Question 1
Define a class Products that contains the following information:
-Declaration of private member variables: soft_drinks,fruits and water(all of integer type)
-Declaration of public member functions:
>A default constructor with the following default values for the member variables: 10 softdrinks,20 fruits,30 bottles of water.
>A void function that sets values to the different products(soft_drinks,fruits,water) based on the argument values given when called.
>A void function that displays on the screen the actual number of products(soft_drinks,fruits,water).
Question 2
Write a C++ code that implements ONLY the function char_and_space(char*sentence,char c1) of return type int. The function counts how many times the character c1 is found in the string sentence followed by a space and returns the results. Example: For sentence "Students of blabla, boys and girls." and char c = 's' the function should return 2. Note1: You are not allowed to use any predefined c-string functions of cstring library. Note2: Use the pointer notation ONLY.DO NOT use array index [] notation.
Question 3
Write a C++ program that prompts the user to give a filename and a word.The program should read the file line-by-line , and display on the screen only the lines that contain the given word, as well as the corresponding line number.Your program should perform some error checking regarding files. Note1: You MUST use string objects from the C++ class string, and NOT c-strings(array of characters). Note2: You may find of use the member function find of the class string. It returns the position of the first occurrence in the string of the searched content. If the content is not found, member value npos is returned.
Question 4
(a)Define a header file and its definition module called players_lib.h and players_lib.cpp respectively. In players_lib.h define a structure Player that contains the following information: name, surname, weight and a function that has as formal parameters an array of Players and an integer number size. In players_lib.cpp define that function to prompt the user to give the required information for 50 players and store them in the array.
(b)Assume that we need to keep information of 50 players. In mainC.cpp declare an array to hold the required information and call the function of part (a) to fill in the necessary information of the 50 players. Then use the main() function to display on the screen all players information.
Please note, that this is not a homework site. We won't do your homework for you. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.
We didn't see your attemts to solve this problem youself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again.
It's not a homework or something that i will get a grade on its some exercises that i can solve them i don't know how that's what i want someone who knows them someone who knows how to solve them and help me
i want to know how they are solved so i can know the way to solve them for practice and these are the ones i find more difficult from all others i am working. The emergency it's because i tried and read many tutorials but again i can i am stuck not in the middle or the end but at the start and i want to punch myself
yes i read tutorials and i can't find such complex examples just basic examples which i understand but i don't know how to use them in my exercises. a class is a data type. Are you going to help me or you are going to play the smartass and act me like you are god and know everything. Because if you know so well to program these exercises will be a piece of cake for you.
What problems are you having exactly? As has been stated no one wants to do your homework for you which is what your asking for when you post verbatim a bunch of homework questions with no explanation of what you're stuck on.
Yeah I usually help everyone whenever I get a chance, but if anyone was to help this guy it wouldn't show him that this behavior is unacceptable both in a programming view (no effort involved) and in an attitude view (complete jackass). Do you usually go up to doctors and yell at them and then demand a free surgery? That's insanity.