What is difference between a template and a macro

Assignment Help C/C++ Programming
Reference no: EM131394336

Q1. What is a copy constructor in c++? How it is declared ? Explain with a suitable example.

Q2. How can the unary operator ++ be overloaded in C++ for postfix operation ? Demonstrate with a suitable example.

Q3.3. How does C++ help with the trade-off of safety vs. usability?

Q4. What is the output of following program? Justify your answer.

#include <iostream>

using namespace std;

class Test

{

    static int x;

public:

    Test() { x++; }

    static int getX() {return x;}

};

int Test::x = 0;

int main()

{

    cout << Test::getX() << " ";

    Test t[5];

    cout << Test::getX();

}

Q5. What is difference between a template and a macro? Give suitable example of each.

Q6. Implement a function f that takes three arguments: pointers to two integer arrays A and B and the size N. It then populates B where B[i] is the product of all A[j] where j ≠ i.

For example : if A = { 2,1,5,9 } then B will be { 45,90,18,10 }.

Q7. How can we create an abstract class in C++ ? Explain with suitable example.

Q8. Write a C++ program to copy one file into another.

Q9. What will be the result of following expressions when they are executed in sequence?

#include<iostream.h>

#include<conio.h>

 void main()

{

 int a = 10, b = 20,c,d,e,f;

 c = ++a + ++a + ++a;

 b=b++ + b++;

 e=a++ + --a + b--;

 f=b-- & ++a + b++;

 cout<<c<<d<<e<<f;

 getch();

}

Q10. Write a C++ program using classes and objects to simulate result preparation system for 20students. The data available for each student includes:Name (includes first, mid and last name each of size 20 characters), Rollno, Marks in 3 subjects. The percentage marks and grade are to be calculated from the following information:

Percentage marks                   grade

 <50                                       F

 ≥ 50<60                                 D

≥ 60<75                                  C

≥ 75<90                                  B

≥ 90<100                                A

Reference no: EM131394336

Questions Cloud

Design and implementation of smart antennas : A Literature Review on Design and Implementation of Smart Antennas for High Bandwidth communications through
Prepare fund financial statements for a city : Title: Assistant Controller in Your Home Town. Prepare fund financial statements for a city, state or county government. Communication: Learners demonstrate ability to communicate clearly both orally and in writing
How much is the minimumdividend that the firm pays each year : If Absolute has 40,000 shares outstanding, how much is the minimum (low regular) dividend that the firm pays each year?
What is the range of the strength scores : Describe the shape of this distribution.- What is the median of the distribution?- What is the range of the strength scores?
What is difference between a template and a macro : What is a copy constructor in c++? How it is declared ? Explain with a suitable example and how can the unary operator ++ be overloaded in C++ for postfix operation ? Demonstrate with a suitable example.
Describe the shape of the distribution : What is the median sugar content?- What is the range of the sugar contents of these cereals.- Describe the shape of the distribution.
Network solution to e-grocery store : Write a paper on Topic: Network Solution to E-Grocery Store, Your paper must include introduction, General Security Measures, Designing Effective Networks.
How much will be paid in dividends : Last year, Headline News Corporation paid $600,000 in dividends and retained $360,000 of the earnings it generated. The company follows a constant payout ratio dividend policy. If Headline generates $1.25 millon in income this years, how much will..
Features of distribution in both histogram and the boxplot : What features of the distribution can you see in both the histogram and the boxplot?- What features of the distribution can you see in the histogram that you could not see in the boxplot?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd