Total members 11894 |It is currently Fri Nov 22, 2024 1:15 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





i would like to know what is the output for this program.

Code:
#include <iostream>

using std::cout;
using std::endl;
using std::ios;
#include<new>

#include<iomanip>
//using std::fix;
using std::setprecision;

template typename T >
class Array{
public:
    Array(
int=5);
    ~Array() {
delete[] arrayPtr; }
    
T arrayRef(int)const;
    
int getsize() const;

private:
    
int size;
    
*arrayPtr;
};
templatetypename T>
Array< 
>::Array(int x)
{
    
size=x;
    
arrayPtr[i] = 1.0 i;
}
template<typename T>
Array< >::arrayRef(int num)const
{
    return 
arrayPtr[num];
}
templatetypename T >
int Array<T>::getSize() const
{
return 
getSize;
}
template <typename T >
void printArray(const Array<T> &a)
{
    for (
int i=0ia.getSize(); i++)
        
cout << a.arrayRef(i) << " ";
    
cout << endl << endl;
}
int main()

    
int fixed;
    Array< 
int intArray(4);
    Array< 
double doubleArray;

    
cout << setprecision(2);
    
printArrayintArray );
    
printArraydoubleArray);

    return 
0;





Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Array C++ Class
 Define class helper class to check the method existance     -  
 java abstract class,concrete class and interface     -  
 relationship between the Canvas class and the Graphics class     -  
 Array difference for associate array     -  
 inner class that is a member of an outer class?     -  
 Define class inside another class C++     -  
 compare an array with another array?     -  
 load class to applet- load frame class to applet     -  
 Array shuffle     -  
 PHP Array Functions     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com