Friday, 14 September 2018

Fill up the blanks in the constructor to get the output as per the test cases.

Fill up the blanks in the constructor to get the output as per the test cases. Sample Test Cases
InputOutput
Test Case 1.5 D6 C A
6 C A
Test Case 2.9 I10 H A
6 C A
Test Case 3.6 A7 @ A
6 C A
Test Case 4.5 F6 E A
6 C A

#include <iostream>
using namespace std;

class Sample {
    public:
    int data_ ;
    char  graph_, data_or_graph_;

Sample(int x =6,char y='C',char z='A'): data_(x), data_or_graph_(y),graph_(z) {
        cout << data_ << " " << data_or_graph_ << " " << graph_ << " " << endl;
    }
}; // End of the class

int main() {
    int x; char y;
    cin >> x >> y ;
    Sample s1(x+1, y-1), s3;
    return 0;
}

No comments:

Post a Comment

Featured post

In all other cases the driver is not insured. If the marital status, sex and age of the driver are the inputs, write a program to determine whether the driver is to be insured or not.

  #include #include int main() { char ms;   printf("Is Driver married (Y/N): ");  scanf("%c",&ms);   if(ms=='y&#...

Popular Posts