Writing a function with one parameter to evaluate an expression.
Finding and area and circumference of a circle using two separate functions for each of them
Writing function sumofdigits() to add the digits in any integer number and then using this function in the main function.
Function to repeat a character in display for number of times desired.
The default parameters in function becomes active when given parameter value is not passed. Here we learn this setting at the level of function prototype.
The default parameters in function becomes active when given parameter value is not passed. Here we learn this setting at the level of function definition.
Writing a program to find student division using the const argument for maximum marks.
Writing polymorphic function based on difference on number of parameters.
Writing polymorphic function based on difference on parameters data type.
Using the example of salary preparation for building related functions and using function in function calls.
Using a bool output function isPrime() which has multiple return paths for prime number check and then using this function to print a prime series for given number of terms
( As In Exam - CBSE12A-2018 )
Write the definition of a function SumEO(int VALUES[], int N) in C++, which
Write the definition of a function SumEO(int VALUES[], int N) in C++, which should display the sum of even values and sum of odd values of the array separately.
Example: if the array VALUES contains 25 20 22 21 53
Then the functions should display the output as: Sum of even values = 42 (i.e 20+22) Sum of odd values = 99 (i.e 25+21+53)
( As In Exam - CBSE12A-2017 )
Look at the following C++ code and find the possible output(s) from the
Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the maximum values that can be assigned to each of the variables N and M.
Note:
void main() { randomize(); int N=random(3),M=random(4); int DOCK[3][3] = {{1,2,3},{2,3,4},{3,4,5}}; for(int R=0; R<N; R++) { for(int C=0; C<M; C++) cout<<DOCK[R][C]<<" "; cout<<endl; } }
(i) 1 2 3 2 3 4 3 4 5
(ii) 1 2 3 2 3 4
(iii) 1 2 2 3
(iv) 1 2 2 3 3 4
( As In Exam - CBSE12A-2016 )
Find and write the output of the following C++ program code: Note: Assu
Find and write the output of the following C++ program code: Note: Assume all required header files are already included in the program.
typedef char TEXT[80]; void JumbleUp(TEXT T) { int L=strlen(T); for (int C=0;C<L1;C+=2) { char CT=T[C]; T[C]=T[C+1] T[C+1]=CT; } for (C=1;C<L;C+=2) if (T[C]>='M' && T[C]<='U') T[C]=’@’; } void main() { TEXT Str="HARMONIOUS"; JumbleUp(Str); cout<<Str<<endl; }
Look at the following C++ code and find the possible output(s) from the optio
Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the maximum and the minimum values that can be assigned to the variable PICKER.
Note: – Assume all the required header files are already being included in the code. – The function random(n) generates an integer between 0 and n-1
void main() { randomize(). int PICKER. PICKER=1+random(3). char COLOR[][5]={"BLUE","PINK","GREEN","RED"}. for(int I=0;I<=PICKER;I++) { for(int J=0;J<=I;J++) cout<<COLOR[J]. cout<<endl. } }
( As In Exam - CBSE12D-2016 )
typedef char STRING[80]; void MIXITNOW(STRING S) { int Size=strlen(S); for (int I=0;I<Size-1;I+=2) { char WS=S[I]; S[I]=S[I+1]; S[I+1]=WS; } for (I=1;I<Size;I+=2) if (S[I]>='M' && S[I]<='U') S[I]=’@’; } void main() { STRING Word="CRACKAJACK"; MIXITNOW(Word); cout<<Word<<endl; }
Write a c++ program to define a function si(p,r,t) with input parameters as p
Write a c++ program to define a function si(p,r,t) with input parameters as p, r and t for principal, rate and term and let it return no data. The calculated value of interest may be saved in a global variable. Also show the demonstration of working of this function by calling it in the main() routine by passing some fixed values of p,r and t. In the main routine print the final amount by adding the interest to the principal amount.
Write output of the following program. Please do take care about the default
Write output of the following program. Please do take care about the default parameters given while calling the function.
A c++ program given here has some errors. Please correct the errors to make i
A c++ program given here has some errors. Please correct the errors to make it a working program. Assume any data values required to make it working correctly.
Write a function to return the largest of three integer numbers passed to it
Write a function to return the largest of three integer numbers passed to it as value. Also pass a variable as reference which will be set to 1 if all the numbers passed are same. Show implementation of this function in the main routine with appropriate messages.
Write a c++ program using function overloading using the following prototype
Write a c++ program using function overloading using the following prototype – int area(int); //For area of square float area(float); //For area of circle int area(int,int); //For area of rectangle show working of this program by calling this function into the main routine using some assumed valued.
Write a program where a function of prototype int ispalin(int) is written, wh
Write a program where a function of prototype int ispalin(int) is written, which returns 1 when given input number is a palindrome (eg. 121, 16561) else returns 0. Show implementation of this function in main routine by collecting a positive integer from the user.
Write a program to reverse the given integer number.using a separately called
Write a program to reverse the given integer number.using a separately called function to reverse the number.
Find syntactical errors in the following program and rewrite the program afte
Find syntactical errors in the following program and rewrite the program after underlining the corrected portion.
#include<iostreamh> using namespace std; void toUpper(char x) {return ((char) (x+1));} main() { char c, String[]=”DOGS ARE NOT CATS”; for(int i=0;String[i]!= ;i++) if(String[i]==’ ‘) cout<<endl; else { c=toUpper(String[i]);cout<<c;} return 0; }
Write a function named DIVISION to pass maximum marks and marks obtained by
Write a function named DIVISION to pass maximum marks and marks obtained by a student. Return division as integer value 1, 2 3 or 0 as follows
=60 % as first division – return 1 >=45 <60 % as Second Division – return 2 >=33 <45 % as Third Division – return 3 <33 as Fail – return 0
Show implementation of above function in main routine with some fixed values.
Write a function to find the sum of following series with any looping stateme
Write a function to find the sum of following series with any looping statement 12 + 22 + 32 ……… +72