2 Replies - 250 Views - Last Post: 06 October 2012 - 10:26 PM Rate Topic: -----

#1 love2009  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 05-October 12

l cant debug this code.

Posted 06 October 2012 - 09:47 PM

can someone check out this code for me,l cant seems to be able to build it. l am writing a function template which takes two parameters one a pointer to any array of type T and other integer, declaring a 3 array of elements.


// function template
#include <iostream>
using namespace std;

template <class T>
T GetMax (T a, T B)/> {
  T result;
  result = (a>B)/>? a : b;
  return (result);
}

int main () {
  int i=10, j=10, k;
  long l=10, m=10, n;
  k=GetMax<int>(i,j);
  n=GetMax<long>(l,m);
  cout << k << endl;
  cout << n << endl;

  return 0;
}

This post has been edited by Salem_c: 06 October 2012 - 09:50 PM
Reason for edit:: added [code][/code] tags - learn to use them yourself


Is This A Good Question/Topic? 0
  • +

Replies To: l cant debug this code.

#2 snoopy11  Icon User is online

  • Engineering ● Software
  • member icon

Reputation: 802
  • View blog
  • Posts: 2,363
  • Joined: 20-March 10

Re: l cant debug this code.

Posted 06 October 2012 - 10:23 PM

Hi,

It builds and runs ok,

What errors if any are you getting, which os and environment are you using ?


Snoopy.
Was This Post Helpful? 0
  • +
  • -

#3 love2009  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 05-October 12

Re: l cant debug this code.

Posted 06 October 2012 - 10:26 PM

View Postsnoopy11, on 06 October 2012 - 10:23 PM, said:

Hi,

It builds and runs ok,

What errors if any are you getting, which os and environment are you using ?


Snoopy.



thanks l appreciate your response l was able to build and debug it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1