You are here:

C++/Duplicates

Advertisement


Question
I have a test tomorrow on the following:
Q1 - Given an array of unsorted positive integers, find the total count of elements that are not duplicated. For example, if the given array is { 3, 4, 2, 3, 4, 1) then the count of elements that are not duplicated is TWO ( 2 and 1 are not duplicated)

Q2 - Remove the duplicates from the same array and create a unique array

Q3 - Determine whether the integer is odd or even? (no runtime functions)

Q4 - Concatenate string 2 onto the end of string 1 (no runtime functions).

Your help is appreciated.

Answer
These are easy questions for anyone learning C++. I will refer you some example code, and hope you go to the examination after having understood (and written some small programs yourself) the code:

array examples: http://www.fredosaurus.com/notes-cpp/arrayptr/array-examples.html

http://www.cplusplus.com/doc/tutorial/arrays.html
http://www.cplusplus.com/doc/tutorial/ntcs.html
http://www.uow.edu.au/~nabg/ABC/C11.pdf

Skip the material on multi-dimensional arrays for now. Hope this helps.

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Amit Kumar

Expertise

I can answer Cplusplus language and library questions, including STL, ACE, Boost. I have a good background in Mathematics.

Experience

Programming in CPP for about 8 years. Industry experience of 4 years.

Education/Credentials
Bachelors and Masters in Computer Science from Indian Institute of Technology Delhi.

©2016 About.com. All rights reserved.