Click here to Skip to main content
15,919,778 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to change the size of one pane in the SplitterWnd ? Pin
Toni7829-Jul-03 18:58
Toni7829-Jul-03 18:58 
GeneralRe: Thanks Pin
benben29-Jul-03 19:36
benben29-Jul-03 19:36 
GeneralRe: Thanks Pin
jhwurmbach29-Jul-03 22:01
jhwurmbach29-Jul-03 22:01 
GeneralI'm writing a wordpad with API, please help me... Pin
coolhair29-Jul-03 17:31
coolhair29-Jul-03 17:31 
GeneralRe: I'm writing a wordpad with API, please help me... Pin
Toni7829-Jul-03 18:43
Toni7829-Jul-03 18:43 
GeneralRe: I'm writing a wordpad with API, please help me... Pin
David Crow30-Jul-03 4:10
David Crow30-Jul-03 4:10 
GeneralRe: I'm writing a wordpad with API, please help me... Pin
Ryan Binns30-Jul-03 5:28
Ryan Binns30-Jul-03 5:28 
QuestionWhy Link Error? Pin
EastDragon29-Jul-03 17:19
EastDragon29-Jul-03 17:19 
Hi! I am new to C++. I want to implement the any size integer class. But I got link error, the vs.net 2003 show this error message:
MyLargeInt error LNK2019: unresolved external symbol "public: __thiscall LargeInt<60>::~LargeInt<60>(void)" (??1?$LargeInt@$0DM@@@QAE@XZ) referenced in function _main

Please help me! Thank you!

here is my code,I haven't complete the code yet
//LargeInt.h My any size integer class header file
#pragma once

#include <iostream>

using namespace std;

template<int i_size>
class LargeInt
{
friend ostream & operator << (ostream &,const LargeInt&);
friend istream & operator >> (istream &,LargeInt&);
public:
LargeInt(int number);
~LargeInt(void);
private:
int size;
int *data;
bool negative;

};

//LargeInt.cpp My any size integer class implement file
#include "StdAfx.h"
#include ".\largeint.h"

template<int i_size>
ostream &operator << (ostream& output,const LargeInt<i_size>& temp)
{
//int counter;

if (temp.negative)
output<<"-";

for (int i=temp.size;i!=0;i--)
output<<temp.data[i];

return output;
}

template<int i_size>
istream &operator >> (istream& input,LargeInt<i_size>& temp)
{
char ch;
int counter = 0;
int *buffer;
buffer=new int[temp.size];

memset(temp.data,0,temp.size);
memset(buffer,0,temp.size);

while((ch = input.get()) != '\n')
{ //loop while they have not entered a RETURN
if( (counter == 0) && (ch == '-') )
{
temp.negative = true;
}
else
{
if((ch >= 48) && (ch <= 57))
buffer[counter] = ch - 48;
counter++;
}

}

temp.size = counter;

i = 0;
for (int i=0;i<counter;i++)
{
temp.data[i]=buffer[counter-i]
}

delete[] buffer;

return input;

}

template<int i_size>
LargeInt< i_size >::LargeInt(int number)
{
int temp;
data=new int[i_size];
memset(data,0,i_size);

negative=(number>0?false:true);

negative=true?number=-number:;

temp=number;

if (number == 0)
{
data[0] = 0;
size = 1;
}
else
{
for(size = 1; ; size++)
{
data[size-1] = temp % 10;
temp = int(temp) / int(10);
if(temp == 0)
break;
}
}

}

template<int i_size>
LargeInt< i_size >::~LargeInt(void)
{
delete[] data;
}


// MyLargeInt.cpp : Defines the entry point for the console application.
// Main test file

#include "stdafx.h"
#include "iostream"
#include "LargeInt.h"

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
LargeInt<60> myi=120;//I want a integer that can hold 60 digit length
return 0;
}



Let's roll!
AnswerRe: Why Link Error? Pin
Toni7829-Jul-03 18:31
Toni7829-Jul-03 18:31 
GeneralRe: Why Link Error? Pin
EastDragon29-Jul-03 19:10
EastDragon29-Jul-03 19:10 
GeneralRe: Why Link Error? Pin
Toni7829-Jul-03 19:32
Toni7829-Jul-03 19:32 
GeneralRe: Why Link Error? Pin
EastDragon29-Jul-03 21:27
EastDragon29-Jul-03 21:27 
GeneralRe: Why Link Error? Pin
Bob Stanneveld30-Jul-03 3:15
Bob Stanneveld30-Jul-03 3:15 
GeneralRe: Why Link Error? Pin
Toni7830-Jul-03 14:51
Toni7830-Jul-03 14:51 
GeneralRe: Why Link Error? Pin
EastDragon30-Jul-03 15:06
EastDragon30-Jul-03 15:06 
AnswerRe: Why Link Error? Pin
Michael Dunn29-Jul-03 20:25
sitebuilderMichael Dunn29-Jul-03 20:25 
GeneralRe: Why Link Error? Pin
EastDragon29-Jul-03 21:32
EastDragon29-Jul-03 21:32 
GeneralRe: Why Link Error? Pin
Michael Dunn30-Jul-03 7:41
sitebuilderMichael Dunn30-Jul-03 7:41 
GeneralRe: Why Link Error? Pin
EastDragon30-Jul-03 14:47
EastDragon30-Jul-03 14:47 
GeneralRe: Why Link Error? Pin
John M. Drescher30-Jul-03 14:58
John M. Drescher30-Jul-03 14:58 
Generaladd text on a jpeg file Pin
johnsmith29-Jul-03 16:04
johnsmith29-Jul-03 16:04 
GeneralRe: add text on a jpeg file Pin
johnsmith30-Jul-03 19:36
johnsmith30-Jul-03 19:36 
Questionswitch cpp and h in vc7 ide? Pin
novachen29-Jul-03 14:18
novachen29-Jul-03 14:18 
GeneralIP address - getting programmatically Pin
john john mackey29-Jul-03 12:41
john john mackey29-Jul-03 12:41 
GeneralRe: IP address - getting programmatically Pin
Mike Dimmick29-Jul-03 13:16
Mike Dimmick29-Jul-03 13:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.