Question

Suppose the following declarations appear in the mainfunction of a C++ program: string name, qualification; char sex; int age

1. findCandidate(m, 30, nameP, 7, B. Curr); 2. findCandidate (sex, age, name, yearsExperience, qualification); 3. findCan

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER :

Arguments are in order : char , int &, string &, int, string

so option 4 is the correct way of calling this function

findCandidate('m',age,name,7,"B.Curr");

CODE :

#include <iostream>

using namespace std;

// A dummy function to check function call and arguments it takes
int find_candidate(char a,int & agep, string &namep,int year, string quali)
{
cout<<a<<endl;
cout<<&agep<<endl;
cout<<&namep<<endl;
cout<<year<<endl;
cout<<quali;
return 0;
}

int main()
{
string name="name";
int age = 12;
//calling the function
find_candidate('m',age,name,7,"b.com");


return 0;
}

#include <iostream> using namespace std; // A dummy function to check function call and arguments it takes int find_candidate

OUTPUT :

You can see in this way, the function is being called without any error .

m Ox69fecc Ox69fede 7 b.com Process returned o (Oxo) Press any key to continue. execution time : 0.219 s

THANK YOU.....!!!!

Add a comment
Know the answer?
Add Answer to:
Suppose the following declarations appear in the mainfunction of a C++ program: string name, qualification; char...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 2 COS1511 MAY/JUNE2020 SECTION A 20 MARKS Choose one option for every question. If, for example...

    2 COS1511 MAY/JUNE2020 SECTION A 20 MARKS Choose one option for every question. If, for example you choose option 2 as the correct answer for Question 1, and option 4 as the correct answer for Question 2, please answer as follows: 1. 2 2.4 etc. QUESTION 1 2 marks Suppose the following declarations appear in the nai nfunction of a C++ program: string nane, course; char sex; int age; float cost; bool approved; If the following function header is given:...

  • Suppose the following declarations appear in the mainfunction of a C++ program: string name, course, date;...

    Suppose the following declarations appear in the mainfunction of a C++ program: string name, course, date; float cost; bool approved; Suppose the following calling statement appears in the mainfunction: approveFunds ("Memory enhancement", "Ellen Subisa", date, 595.00, approved); Which of the options below is a correct function header of the function approve Fundsin the main function? 1. void approveFunds (string course, string name, string & date, float coste, bool & approved) 2. void approveFunds (string & course, string & name, string...

  • QUESTION 3 2 marks Suppose the following declarations appear in the nai nfunction of a C++...

    QUESTION 3 2 marks Suppose the following declarations appear in the nai nfunction of a C++ program: string nane, course, date; float cost; bool approved; Suppose the following calling statement appears in the nai nfunction: approveFunds("Menory enhancement", "Ell en Subi sa", date, 595.00, approved): Which of the options below is a correct function header of the function approveFunds in the main function? 1. void approveFunds(string coursep, string namep, string & dat ep, float cost P, bool & approved) 2. void...

  • Part1. Write a C program contains the following declarations: char customer_name[N_CUSTOMERS][MAX...

    Part1. Write a C program contains the following declarations: char customer_name[N_CUSTOMERS][MAX_NAME_LENGTH]; int customer_number[N_CUSTOMERS] A program uses a text file that contains the following data on each line: The customer number is an int, and the first and last names are alphabetic strings that contain no whitespace. The last and first names themselves are however separated by whitespace. Write a C function with the following prototype: void read_customer (char name[][MAX_NAME_LENGTH], int number[], int position, FILE *cust_file) Your function should read a...

  • Given the following program: #include <stdio.h> struct student { int id; char name[20]; char grade; };...

    Given the following program: #include <stdio.h> struct student { int id; char name[20]; char grade; }; void func(struct student stud); int main() { struct student astud; astud.id=9401; strcpy(astud.name, "Joe"); astud.grade = 'A'; func(astud); return 0; } Abdelghani Bellaachia, CSCI 1121 Page: 16 void func(struct student astud) { printf(" Id is: %d \n", astud.id); printf(" Name is: %s \n", astud.name); printf(" Grade is: %c \n", astud.grade); } Modify this program to include the address of a student as a separate structure....

  • C programming The program will require the following structure: struct _data { char *name; long number;...

    C programming The program will require the following structure: struct _data { char *name; long number; }; The program will require command line arguments: int main(int argv, char **argc) { Where argv is the number of arguments and argc is an array holding the arguments (each is a string). Your program must catch any case where no command line arguement was provided and print a warning message (see below). You MUST include/use the following functions, defined as follows: int SCAN(FILE...

  • #include <iostream>   #include <string>   using namespace std;      void get_user_string(string *);   string convert_to_dash(String* );   int_search_and_replace(char, string,...

    #include <iostream>   #include <string>   using namespace std;      void get_user_string(string *);   string convert_to_dash(String* );   int_search_and_replace(char, string, string &);       int main (){    string s;    cout << "Enter a string:" << endl;    get_user_string(&s);        string dash_version = convert_to_dash(&s)    if ( dash_version != 32){    &s.push_back('-');    } Here is an example operation of the completed program: Please enter a string: the weather is great! The dash-version of your string is: Please tell me the char that...

  • In c++ programming, can you please edit this program to meet these requirements: The program that...

    In c++ programming, can you please edit this program to meet these requirements: The program that needs editing: #include <iostream> #include <fstream> #include <iomanip> using namespace std; int cal_avg(char* filenumbers, int n){ int a = 0; int number[100]; ifstream filein(filenumbers); if (!filein) { cout << "Please enter a a correct file to read in the numbers from"; }    while (!filein.eof()) { filein >> number[a]; a++; } int total = number[0]; for (a = 0; a < n; a++) {...

  • Consider the following program: # include <iostream> using namesapce std; void Func(int a, int bl double...

    Consider the following program: # include <iostream> using namesapce std; void Func(int a, int bl double number-25.0: int main) f int x-18, y-20; cout<c"Before: x- kex<" and y-eyecendl; Fundxy 1// end of main void Funcfint a, int b) int sum a+b; a-200; b-300; numberanumber+1.0 Which of the statements below are correct? (Select only the correct answers. There may be more than one) D A The statement double number-25.0; declares a global variable number B. The variables x and y are...

  • The program needs to be written in C. Write a function void camelCase(char* word) where word...

    The program needs to be written in C. Write a function void camelCase(char* word) where word consists of more than two words separated by underscore such as “random_word” or "hello_world_my_name_is_sam". camelCase() should remove underscores from the sentence and rewrite in lower camel case” (https:// en.wikipedia.org/wiki/Camel_case). Watch out for the end of the string, which is denoted by ‘\0’. You have to ensure that legal strings are given to the camelCase() function. The program should only run when the input is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT