1. Discuss the concept of arrays of objects. Give examples (10 marks)

2. Write a program to get the average of 10 random numbers given by the user (10 marks)

3. List and describe the arithmetic operators available in C++ (5 marks)

4. List any benefits of Object Oriented Programming (10 marks)

5. List any 5 key words in C++ and describe them (5 marks)

6. Write a C++ program to construct a matrix of size m x n using the concept of constructor (10 marks)

7. Write a program which accepts a set of ten numbers and display the count of negative and the positive values which are entered (10 marks)

8. Write a program in C++ to find factors of a given number (10 marks)

9. Write a C++ program to generate Fibonacci series (10 marks)

10. Write a C++ program to sort an array in ascending order (20 marks)

Duki commented: The answers are in your book for most of these. Read. -1

Um... we don't do homework. We've been through school already. You have to at least attempt to answer these yourself before you can expect any help from us.

1. Discuss the concept of arrays of objects. Give examples (10 marks)
Array form an important part of almost all-programming languages. It provides a powerful feature and can be used as such or can be used to form complex data structures like stacks and queues. An array can be defined as a set of finite number of homogeneous elements or data items. It means as array can contain one type of data only, either all integers, all floating-point numbers, or all characters. Declaration of arrays is as follows:
int a[10];

Ex:-

#include<iostream.h>
#include<conio.h>
Void main( )
{
	int a[10], i ;
	clrscr( );
	cout<<”Enter the array” ;
	for(i = 0 ; I <= 9 ; i++)
	{
		cin>>a[i] ;
	}
	Cout<<”the entered array is” ;
	for(i = 0 ; I <= 9 ; i++) 
	{
		Cout<<a[i]<<endl ;
	}
	Getch( ) ;
}

is this correct

well that depends. An array of objects usually refers to a array of class objects. What you are doing and describing is just a typical array of integers etc. A typical array of objects would be declared like something below.

MyClass obj[10];

If by object you just mean normal values then it looks ok to me.

"Is this correct?" Well, since you asked...

Where should I start?

Array form an important part of almost all-programming languages. It provides a powerful feature and can be used as such or can be used to form complex data structures like stacks and queues. An array can be defined as a set of finite number of homogeneous elements or data items. It means as array can contain one type of data only, either all integers, all floating-point numbers, or all characters. Declaration of arrays is as follows:
int a[10];
...

Your answer to the question reads like something out of a textbook. Did you write that or did you copy it without even understanding it?

(

tag by Fbody)

[code]
#include<iostream.h>
#include<conio.h>
Void main( )
{
int a[10], i ;
clrscr( );
cout<<”Enter the array” ;
for(i = 0 ; I <= 9 ; i++)
{
cin>>a[i] ;
}
Cout<<”the entered array is” ;
for(i = 0 ; I <= 9 ; i++) 
{
Cout<<a[i]<<endl ;
}
Getch( ) ;
}

Did you even try to compile this? This looks like something you belched out without any thought at all hoping someone wouldn't see through it.

<iostream.h> is a pre-standard header. Use <iostream> instead. There are critical functional differences.

<conio.h> is a non-standard header, it's not even part of the Standard even though many compilers support it. Just because it works the way you want it to in one compiler it's not guaranteed to work the same in another compiler, so your code isn't portable. Don't ever use it unless absolutely necessary (which it really never is).

main() must always return an int. Most compilers accept void even though it's not technically correct. Also, C++ is case-sensitive, there is no such data type as "Void" it's "void".

for(i = 0 ; I <= 9 ; i++)
{
cin>>a[i] ;
}

Again, C++ is case sensitive, this won't even compile because implicit declarations aren't allowed.

Cout<<”the entered array is” ;
for(i = 0 ; I <= 9 ; i++) 
{
Cout<<a[i]<<endl ;
}

There's that case-sensitivity thing again... It's "cout", not "Cout".

Getch() is from conio, don't use it. Besides, it's getch(). Use cin.get() instead.

Also, if you're going to post code, use [code] ...code tags... [/code].

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.