Top-Themen

AppleEntwicklungHardwareInternetLinuxMicrosoftMultimediaNetzwerkeOff TopicSicherheitSonstige SystemeVirtualisierungWeiterbildungZusammenarbeit

Aktuelle Themen

Administrator.de FeedbackApache ServerAppleAssemblerAudioAusbildungAuslandBackupBasicBatch & ShellBenchmarksBibliotheken & ToolkitsBlogsCloud-DiensteClusterCMSCPU, RAM, MainboardsCSSC und C++DatenbankenDatenschutzDebianDigitiales FernsehenDNSDrucker und ScannerDSL, VDSLE-BooksE-BusinessE-MailEntwicklungErkennung und -AbwehrExchange ServerFestplatten, SSD, RaidFirewallFlatratesGoogle AndroidGrafikGrafikkarten & MonitoreGroupwareHardwareHosting & HousingHTMLHumor (lol)Hyper-VIconsIDE & EditorenInformationsdiensteInstallationInstant MessagingInternetInternet DomäneniOSISDN & AnaloganschlüsseiTunesJavaJavaScriptKiXtartKVMLAN, WAN, WirelessLinuxLinux DesktopLinux NetzwerkLinux ToolsLinux UserverwaltungLizenzierungMac OS XMicrosoftMicrosoft OfficeMikroTik RouterOSMonitoringMultimediaMultimedia & ZubehörNetzwerkeNetzwerkgrundlagenNetzwerkmanagementNetzwerkprotokolleNotebook & ZubehörNovell NetwareOff TopicOpenOffice, LibreOfficeOutlook & MailPapierkorbPascal und DelphiPeripheriegerätePerlPHPPythonRechtliche FragenRedHat, CentOS, FedoraRouter & RoutingSambaSAN, NAS, DASSchriftartenSchulung & TrainingSEOServerServer-HardwareSicherheitSicherheits-ToolsSicherheitsgrundlagenSolarisSonstige SystemeSoziale NetzwerkeSpeicherkartenStudentenjobs & PraktikumSuche ProjektpartnerSuseSwitche und HubsTipps & TricksTK-Netze & GeräteUbuntuUMTS, EDGE & GPRSUtilitiesVB for ApplicationsVerschlüsselung & ZertifikateVideo & StreamingViren und TrojanerVirtualisierungVisual StudioVmwareVoice over IPWebbrowserWebentwicklungWeiterbildungWindows 7Windows 8Windows 10Windows InstallationWindows MobileWindows NetzwerkWindows ServerWindows SystemdateienWindows ToolsWindows UpdateWindows UserverwaltungWindows VistaWindows XPXenserverXMLZusammenarbeit

VS Express 2012 LNK2019: Verweis auf nicht aufgelöstes externes Symbol

Frage Entwicklung C und C++

Mitglied: mathe172

mathe172 (Level 1) - Jetzt verbinden

30.09.2013 um 21:58 Uhr, 1632 Aufrufe

Hallo,

ich erhalte den folgenden Fehler, beim Versuch, mein Projekt zu kompilieren:

01.
Fehler	1	error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall ifm::integer::integer(void)" (??0integer@ifm@@QAE@XZ)" in Funktion "_main".	C:\Users\Benutzer\documents\visual studio 2012\Projects\Test\Test\power20.obj	Test 
02.
Fehler	2	error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl ifm::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class ifm::integer const &)" (??6ifm@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@ABVinteger@0@@Z)" in Funktion "_main".	C:\Users\Benutzer\documents\visual studio 2012\Projects\Test\Test\power20.obj	Test 
03.
Fehler	3	error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""class std::basic_istream<char,struct std::char_traits<char> > & __cdecl ifm::operator>>(class std::basic_istream<char,struct std::char_traits<char> > &,class ifm::integer &)" (??5ifm@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@std@@AAV12@AAVinteger@0@@Z)" in Funktion "_main".	C:\Users\Benutzer\documents\visual studio 2012\Projects\Test\Test\power20.obj	Test 
04.
Fehler	4	error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""class ifm::integer __cdecl ifm::operator*(class ifm::integer const &,class ifm::integer const &)" (??Difm@@YA?AVinteger@0@ABV10@0@Z)" in Funktion "_main".	C:\Users\Benutzer\documents\visual studio 2012\Projects\Test\Test\power20.obj	Test 
05.
Fehler	5	error LNK1120: 4 nicht aufgelöste Externe	C:\Users\Benutzer\documents\visual studio 2012\Projects\Test\Debug\Test.exe	Test 
06.
 
Die Umstände sind folgende: Wir bekommen von der Uni eine virtuelle Ubuntu Maschine, auf der wir programmieren und kompilieren können. Das ganze ist komplett vorkonfiguriert, unter anderem gibt es ein paar zusätzliche Bibliotheken. Nun wollte ich das ganze aber mit VS Express lösen. BeimBenutzen besagter zusätzlichen Bibliotheken bekomme ich aber obige Fehler. Ich habe den Include-Pfad so angepasst, dass er die Dateien findet, jedoch muss ich wohl etwas übersehen haben

Die Dateien schauen wie folgt aus:
power20.cpp:
01.
//Informatik - Serie 1 - Aufgabe 3 
02.
//Programm: power20.cpp 
03.
//Autor: *** 
04.
 
05.
#include<iostream> 
06.
#include<IFM\integer.h> 
07.
 
08.
int main() { 
09.
  std::cout << "Compute a^20 for a=? "; 
10.
  ifm::integer a; 
11.
  std::cin >> a; 
12.
 
13.
  //computation 
14.
  ifm::integer b = a * a; 
15.
  b = b * b; 
16.
  ifm::integer c = b * b; 
17.
  c = c * c; 
18.
   
19.
  //output b * c, i.e., a^20 
20.
  std::cout << a << "^20 = " << b * c << ".\n"; 
21.
  return 0; 
22.
}
integer.h:
01.
// Programm: integer.h 
02.
// defines integer numbers of arbitrary size 
03.
 
04.
#include <istream> 
05.
#include <ostream> 
06.
#include <deque> 
07.
#include <string> 
08.
 
09.
namespace ifm { 
10.
 
11.
  class integer { 
12.
 
13.
  public:   
14.
    // constructors 
15.
    // ------------ 
16.
    integer();                 // 0 
17.
    integer(int i);            // i 
18.
    integer(unsigned int i);   // i 
19.
    integer(float f);          // f      
20.
    integer(double d);         // d 
21.
    integer(std::string s);         // s 
22.
 
23.
    // arithmetic operators (with the standard semantics) 
24.
    // -------------------------------------------------- 
25.
    integer  operator-() const;    
26.
    integer& operator+=(const integer& x); 
27.
    integer& operator++(); 
28.
    integer  operator++(int); 
29.
    integer& operator-=(const integer& x); 
30.
    integer& operator--(); 
31.
    integer  operator--(int); 
32.
    integer& operator*=(const integer& x); 
33.
    integer& operator/=(const integer& x); 
34.
    integer& operator%=(const integer& x); 
35.
     
36.
    // conversion to double 
37.
    // -------------------------------------------------- 
38.
    double to_double() const; 
39.
     
40.
    
41.
    // global friend operators 
42.
    // ----------------------- 
43.
    friend bool operator==(const integer& x, const integer& y); 
44.
    friend bool operator<(const integer& x, const integer& y); 
45.
    friend std::ostream& operator<<(std::ostream& o, const integer& x); 
46.
    friend std::istream& operator>>(std::istream& i, integer& x); 
47.
 
48.
  private:   
49.
    // typedefs 
50.
    // -------- 
51.
    typedef std::deque<unsigned int>     Seq; 
52.
    typedef Seq::iterator                It; 
53.
    typedef Seq::const_iterator          Cit; 
54.
    typedef Seq::const_reverse_iterator  Crit; 
55.
 
56.
    // data members 
57.
    // ------------ 
58.
    // an integer is represented by a base, a sign, and a sequence 
59.
    // of digits in the given base. 
60.
 
61.
    // the base must be a power of 10 to facilitate decimal input and output 
62.
    static const unsigned int power_ = 4; 
63.
    static const unsigned int base_ = 10000; 
64.
    
65.
    // the sign 
66.
    bool sign_; // false <=> negative 
67.
 
68.
    // the sequence 
69.
    Seq seq_; 
70.
    // represents the nonnegative number 
71.
    //  
72.
    //  \sum_{i=0}^{seq_.size()-1} seq_[i]*base_^i 
73.
    // The number 0 is represented by a length-1-sequence with seq_[0] == 0 
74.
 
75.
    // private member functions 
76.
    // ------------------------ 
77.
   
78.
    // PRE: seq_ is empty 
79.
    // POST: seq_ is initialized to represent the number i   
80.
    void init(unsigned int i); 
81.
 
82.
    // POST: return value is true iff |*this| < |x|. 
83.
    bool abs_less(const integer& x) const; 
84.
 
85.
    // POST: seq_ is updated to represent |*this| + |x|     
86.
    integer& add(const integer& x); 
87.
 
88.
    // PRE: |x| <= |*this| 
89.
    // POST: seq_ is updated to represent |*this| - |x| 
90.
    integer& subtract(const integer& x); 
91.
 
92.
    // PRE: *this != 0, x < base_ 
93.
    // POST: seq_ is updated to represent |*this| * |x| 
94.
    integer& mult(unsigned int x); 
95.
     
96.
    // PRE: x != 0 
97.
    // POST: *this is replaced by the remainder of the division 
98.
    //       of *this by x; r holds the result of the division 
99.
    integer& div(const integer& x, integer& r); 
100.
 
101.
    // PRE: s >= 0 
102.
    // POST: *this is multiplied by base_^s 
103.
    integer& leftshift (int s); 
104.
 
105.
    // POST: returns true true iff highest significand digit is nonzero 
106.
    bool is_normalized() const; 
107.
 
108.
    // POST: returns true iff *this has value 0 
109.
    bool is_zero() const; 
110.
  }; 
111.
 
112.
  // global operators 
113.
  // ---------------- 
114.
  bool operator!=(const integer& x, const integer& y); 
115.
  bool operator<=(const integer& x, const integer& y); 
116.
  bool operator>(const integer& x, const integer& y); 
117.
  bool operator>=(const integer& x, const integer& y); 
118.
 
119.
  integer operator+(const integer& x, const integer& y); 
120.
  integer operator-(const integer& x, const integer& y); 
121.
  integer operator*(const integer& x, const integer& y); 
122.
  integer operator/(const integer& x, const integer& y); 
123.
  integer operator%(const integer& x, const integer& y); 
124.
}
integer.cpp:
01.
// Programm: integer.cpp 
02.
// Implements integer numbers of arbitrary size 
03.
 
04.
#include <deque> 
05.
#include <istream> 
06.
#include <ostream> 
07.
#include<iterator> 
08.
#include <cassert> 
09.
#include <cmath> 
10.
#include <cctype> 
11.
#include <limits> 
12.
#include <IFM/integer.h> 
13.
 
14.
namespace ifm { 
15.
 
16.
  // Implementation: public member functions 
17.
  // --------------------------------------- 
18.
  integer::integer() : sign_(true)  
19.
20.
    seq_.push_back(0);     
21.
    assert (is_normalized()); 
22.
23.
 
24.
  void integer::init(unsigned int i)  
25.
26.
    assert (seq_.empty()); 
27.
    if (i == 0)  
28.
      seq_.push_back(0); 
29.
    else 
30.
      while (i > 0) { 
31.
        seq_.push_back(i % base_); 
32.
        i /= base_; 
33.
34.
35.
 
36.
  integer::integer(int i) : sign_(i >= 0) 
37.
38.
    if (i < 0) i = -i; 
39.
    init(i); 
40.
    assert (is_normalized()); 
41.
42.
   
43.
  integer::integer(unsigned int i) : sign_(true) 
44.
45.
    init(i); 
46.
    assert (is_normalized()); 
47.
48.
 
49.
  integer::integer(float f) : sign_ (f >= 0) 
50.
51.
    int exp;  
52.
    float m = std::frexp (std::abs(f), &exp);  
53.
    // if |f| is nonzero, then |f| = 0.b_1b_2....b_24 * 2^exp  
54.
    // the integer resulting from this is obtained by moving the 
55.
    // comma exp places to the right (and forgetting about the digits 
56.
    // that may still follow) 
57.
    integer b; 
58.
     for (; exp > 0; --exp) { 
59.
      b *= 2; 
60.
      if (m >= 0.5f) { 
61.
	b += 1; 
62.
	m = 2.0f * (m - 0.5f); 
63.
      } else 
64.
	m = 2.0f * m; 
65.
    }   
66.
    seq_ = b.seq_;    
67.
    assert (is_normalized()); 
68.
69.
 
70.
  integer::integer(double d) : sign_ (d >= 0) 
71.
72.
    int exp;  
73.
    double m = std::frexp (std::abs(d), &exp);  
74.
    // if |d| is nonzero, then |d| = 0.b_1b_2....b_53 * 2^exp  
75.
    // the integer resulting from this is obtained by moving the 
76.
    // comma exp places to the right (and forgetting about the digits 
77.
    // that may still follow) 
78.
    integer b; 
79.
    for (; exp > 0; --exp) { 
80.
      b *= 2; 
81.
      if (m >= 0.5) { 
82.
	b += 1; 
83.
	m = 2.0 * (m - 0.5); 
84.
      } else 
85.
	m = 2.0 * m; 
86.
87.
    seq_ = b.seq_; 
88.
    assert (is_normalized()); 
89.
90.
   
91.
  integer::integer(std::string s) : sign_(true) { 
92.
    integer b; 
93.
     
94.
    unsigned int size = s.size(); 
95.
    int index = 0; 
96.
     
97.
    if (size > 0) { 
98.
      if (s[0] == '+') ++index; 
99.
      else if (s[0] == '-') { 
100.
        ++index; 
101.
        sign_ = false; 
102.
103.
       
104.
      while (static_cast<unsigned int>(index) < size) { 
105.
        b *= 10; 
106.
        b += s[index] - '0'; // only works for digits obviously 
107.
        ++index; 
108.
109.
       
110.
       
111.
112.
     
113.
    seq_ = b.seq_; 
114.
    assert (is_normalized()); 
115.
116.
 
117.
  bool integer::abs_less(const integer& x) const 
118.
119.
    if (seq_.size() < x.seq_.size()) return true; 
120.
    if (seq_.size() > x.seq_.size()) return false; 
121.
    Crit i = seq_.rbegin(); 
122.
    Crit j = x.seq_.rbegin(); 
123.
    for (; i != seq_.rend(); ++i, ++j) { 
124.
      if (*i < *j) return true; 
125.
      if (*i > *j) return false; 
126.
127.
    return false; 
128.
129.
 
130.
  integer integer::operator-() const 
131.
132.
    integer x = *this; 
133.
    if (!is_zero()) x.sign_ = !sign_; 
134.
    return x; 
135.
136.
   
137.
  integer& integer::operator+=(const integer& x) 
138.
139.
    if (sign_ == x.sign_) return add(x); 
140.
    if (!abs_less(x)) return subtract(x); 
141.
    integer z = x; 
142.
    z.subtract(*this); 
143.
    std::swap(z, *this);     
144.
    assert (is_normalized()); 
145.
    return *this; 
146.
147.
 
148.
  integer& integer::operator++() 
149.
150.
    return *this += 1; 
151.
  }   
152.
 
153.
  integer integer::operator++(int) 
154.
155.
    integer z = *this; 
156.
    *this += 1; 
157.
    return z; 
158.
159.
   
160.
  integer& integer::operator-=(const integer& x) 
161.
162.
    if (sign_ != x.sign_) return add(x); 
163.
    if (!abs_less(x)) return subtract(x); 
164.
    integer z = x; 
165.
    z.subtract(*this); 
166.
    z.sign_ = !z.sign_; 
167.
    std::swap(z, *this);     
168.
    assert (is_normalized()); 
169.
    return *this; 
170.
171.
 
172.
  integer& integer::operator--() 
173.
174.
    return *this -= 1; 
175.
  }  
176.
 
177.
  integer integer::operator--(int) 
178.
179.
    integer z = *this; 
180.
    *this -= 1; 
181.
    return z; 
182.
183.
 
184.
  integer& integer::operator*=(const integer& x) 
185.
186.
    if (is_zero()) return *this; 
187.
    integer r = 0; 
188.
    r.sign_ = (sign_ && x.sign_ || !sign_ && !x.sign_); 
189.
    for (Cit i = x.seq_.begin(); i != x.seq_.end(); ++i) { 
190.
      integer z = *this; 
191.
      z.mult(*i); 
192.
      r.add(z); 
193.
      seq_.push_front(0); 
194.
195.
    std::swap(r, *this); 
196.
    assert (is_normalized()); 
197.
    return *this; 
198.
199.
 
200.
  integer& integer::operator/=(const integer& x) 
201.
202.
    assert(!x.is_zero()); 
203.
    integer r; 
204.
    div(x, r); 
205.
    std::swap(*this, r);    
206.
    assert (is_normalized()); 
207.
    return *this; 
208.
209.
 
210.
  integer& integer::operator%=(const integer& x) 
211.
212.
    assert(!x.is_zero()); 
213.
    integer r; 
214.
    return div(x, r); 
215.
216.
 
217.
  integer& integer::leftshift(int s) 
218.
219.
    assert (s >= 0); 
220.
    if (!is_zero()) 
221.
      for (int i=0; i<s; ++i) 
222.
	seq_.push_front(0); 
223.
    return *this; 
224.
225.
   
226.
  double integer::to_double() const { 
227.
     
228.
    double ret = 0.0; 
229.
    unsigned int no_double_digits = std::numeric_limits<double>::digits; 
230.
     
231.
    std::deque<unsigned short> binary_digits; 
232.
    integer tmp = *this; 
233.
    if (tmp < 0) tmp *= -1; 
234.
    while (tmp != 0) { 
235.
      binary_digits.push_front(tmp % 2 == 1 ? 1 : 0); 
236.
      tmp /= 2; 
237.
238.
     
239.
    for (std::deque<unsigned short>::iterator it = binary_digits.begin(); it != binary_digits.end(); ++it, --no_double_digits) { 
240.
      if (no_double_digits > 0) ret += 0.5 * *it; 
241.
      ret *= 2; 
242.
243.
    return this->sign_ ? ret : -ret; 
244.
245.
 
246.
  // Implementation: private member functions 
247.
  // ---------------------------------------- 
248.
  integer& integer::add(const integer& x) 
249.
250.
    while (seq_.size() < x.seq_.size()) seq_.push_back(0); 
251.
    bool carry = false; 
252.
    It i = seq_.begin();  
253.
    for (Cit j = x.seq_.begin(); j != x.seq_.end(); ++j, ++i) { 
254.
      *i += *j; 
255.
      if (carry) ++*i; 
256.
      carry = (*i >= base_); 
257.
      if (carry) *i -= base_; 
258.
259.
    if (!carry) return *this; 
260.
    for (; i != seq_.end(); ++i) 
261.
      if (++*i == base_) *i = 0; else return *this; 
262.
    seq_.push_back(1); 
263.
    return *this; 
264.
265.
 
266.
  integer& integer::subtract(const integer& x) 
267.
268.
    assert(!abs_less(x)); 
269.
    It i = seq_.begin(); 
270.
    bool carry = false; 
271.
    for (Cit j = x.seq_.begin(); j != x.seq_.end(); ++j, ++i) { 
272.
      assert(i != seq_.end()); 
273.
      *i += base_ - *j; 
274.
      if (carry) --*i; 
275.
      carry = (*i < base_); 
276.
      if (!carry) *i -= base_; 
277.
278.
    if (carry) { 
279.
      assert(i != seq_.end()); 
280.
      while (*i == 0) { 
281.
        *(i++) = base_ - 1; 
282.
        assert(i != seq_.end()); 
283.
284.
      --*i; 
285.
286.
    while (seq_.back() == 0)  
287.
      if (seq_.size() == 1) {  
288.
        sign_ = true;  
289.
        return *this; 
290.
      } else 
291.
        seq_.pop_back(); 
292.
    return *this; 
293.
294.
 
295.
  integer& integer::mult(unsigned int x)  
296.
297.
    assert (!is_zero()); 
298.
    if (x == 0) return *this = 0; 
299.
    assert(x < base_); 
300.
    unsigned int carry = 0; 
301.
    for (It i = seq_.begin(); i != seq_.end(); ++i) { 
302.
      carry = *i * x + carry; 
303.
      *i = carry % base_; 
304.
      carry /= base_; 
305.
306.
    if (carry > 0) seq_.push_back(carry); 
307.
    return *this; 
308.
309.
 
310.
  integer& integer::div(const integer& x, integer& r) 
311.
312.
    if (abs_less(x)) { 
313.
      r = 0; 
314.
      return *this; 
315.
316.
    // compute sign 
317.
    r.sign_ = (sign_ && x.sign_ || !sign_ && !x.sign_); 
318.
    r.seq_.clear(); 
319.
 
320.
    // align divisor and initialize upper and lower bound for 
321.
    // binary search for multiplicator 
322.
    integer d = x; 
323.
    unsigned int sh = 1; 
324.
    unsigned int denh = d.seq_.back(); // highest digit of denominator 
325.
    while (d.seq_.size() < seq_.size()) { 
326.
      d.seq_.push_front(0); 
327.
      ++sh; 
328.
329.
    if (abs_less(d)) { 
330.
      d.seq_.pop_front(); 
331.
      --sh; 
332.
333.
 
334.
    do { 
335.
      // binary search for multiplicator in suitable range [low,upp) 
336.
      // there are three cases: 
337.
      // (a) *this < d 
338.
      // (b) *this >= d and both have the same size 
339.
      // (c) *this >= d and *this has one digit more 
340.
      unsigned int numh; // leading 0, 1, or 2 digits of *this  
341.
      if (abs_less (d))  
342.
	numh = 0;  // case (a) 
343.
      else {		     
344.
	numh = seq_.back(); // cases (b), (c) 
345.
	if (d.seq_.size() < seq_.size()) 
346.
	  numh =  numh * base_ + seq_[seq_.size()-2]; // case (c) 
347.
      }     
348.
      unsigned int low = numh / (denh + 1); 
349.
      unsigned int upp = numh / denh + 1; 
350.
      if (upp > base_) upp = base_; 
351.
      unsigned int t;      
352.
      integer dt;       
353.
      // Invariant: multiplicator in [low, upp) 
354.
      do { 
355.
        t = (low + upp) / 2;       
356.
	dt = d; 
357.
        dt.mult(t); 
358.
        if (abs_less(dt)) upp = t; else low = t; 
359.
      } while (upp - low > 1); 
360.
      
361.
      // subtract multiple of divisor 
362.
      r.seq_.push_front(low); 
363.
      if (t != low) { 
364.
	dt = d; 
365.
	dt.mult(low); 
366.
367.
      subtract(dt); 
368.
       
369.
      // cut off trailing zero in divisor 
370.
      d.seq_.pop_front(); 
371.
    } while (--sh > 0); 
372.
    assert (is_normalized()); 
373.
    return *this; 
374.
375.
 
376.
  bool integer::is_normalized() const 
377.
378.
    return !seq_.empty() && (seq_.size()==1 || seq_[seq_.size()-1] != 0); 
379.
380.
 
381.
  bool integer::is_zero() const 
382.
383.
    return seq_.size()==1 && seq_[0] == 0; 
384.
385.
 
386.
  // global operators 
387.
  // ---------------- 
388.
  bool operator==(const integer& x, const integer& y) 
389.
390.
    return x.sign_ == y.sign_ && x.seq_ == y.seq_; 
391.
392.
   
393.
  bool operator!=(const integer& x, const integer& y) { return !(x == y); } 
394.
 
395.
  bool operator<(const integer& x, const integer& y) 
396.
397.
    if (x.sign_ != y.sign_) return x.sign_ < y.sign_; 
398.
    if (x.sign_) return x.abs_less(y); 
399.
    return y.abs_less(x); 
400.
401.
   
402.
  bool operator<=(const integer& x, const integer& y) { return !(y < x); } 
403.
  bool operator> (const integer& x, const integer& y) { return y < x;    } 
404.
  bool operator>=(const integer& x, const integer& y) { return !(x < y); } 
405.
 
406.
  integer operator+(const integer& x, const integer& y) 
407.
408.
    integer z = x; 
409.
    z += y; 
410.
    return z; 
411.
412.
   
413.
  integer operator-(const integer& x, const integer& y) 
414.
415.
    integer z = x; 
416.
    z -= y; 
417.
    return z; 
418.
419.
   
420.
  integer operator*(const integer& x, const integer& y) 
421.
422.
    integer z = x; 
423.
    z *= y; 
424.
    return z; 
425.
426.
 
427.
  integer operator/(const integer& x, const integer& y) 
428.
429.
    integer z = x; 
430.
    z /= y; 
431.
    return z; 
432.
433.
 
434.
  integer operator%(const integer& x, const integer& y) 
435.
436.
    integer z = x; 
437.
    z %= y; 
438.
    return z; 
439.
440.
 
441.
 
442.
  std::ostream& operator<<(std::ostream& o, const integer& x) 
443.
444.
    if (!x.sign_) o << "-";       
445.
    bool leading_zeros = true; // need to skip them 
446.
    for (integer::Crit i = x.seq_.rbegin(); i != x.seq_.rend(); ++i) { 
447.
      std::deque<unsigned int> decimal_digits; 
448.
      unsigned int decimal_number = *i; 
449.
      for (unsigned int j=0; j<integer::power_; ++j) { 
450.
	decimal_digits.push_front(decimal_number % 10); 
451.
	decimal_number /= 10; 
452.
453.
      for (unsigned int j=0; j<integer::power_; ++j) { 
454.
	unsigned int d = decimal_digits[j]; 
455.
	if (!leading_zeros || d != 0 || j == integer::power_-1) { 
456.
	  o << d; 
457.
	  leading_zeros = false; 
458.
	}    
459.
460.
461.
    return o; 
462.
463.
 
464.
  std::istream& operator>>(std::istream& i, integer& x) 
465.
  {   
466.
    const char zero = '0'; 
467.
    char c; 
468.
    for (;;) { 
469.
      c = i.peek(); 
470.
      if (std::isspace(c))  
471.
	i.get(); 
472.
      else 
473.
	break; // all whitespaces eaten 
474.
475.
    // check for sign 
476.
    bool negative = false; 
477.
    if (c == '+' || c == '-') { 
478.
      negative = (c == '-'); 
479.
      i.get(); 
480.
      c = i.peek(); 
481.
    }  
482.
    // now c is the first digit; we collect the digits 
483.
    // in bunchs of integer::power_ many 
484.
    if (std::isdigit(c)) { 
485.
      x = 0; 
486.
      unsigned int y = 0; 
487.
      unsigned int read = 0; 
488.
      unsigned int ten_to_read = 1; 
489.
      do {  
490.
	y = 10 * y + (c-zero); 
491.
	i.get(); 
492.
	++read; 
493.
	ten_to_read *= 10; 
494.
	if (read == integer::power_) { 
495.
	  x.leftshift(1); 
496.
	  x.seq_[0] = y;  
497.
	  y = 0; 
498.
	  read = 0; ten_to_read = 1; 
499.
500.
	c = i.peek(); 
501.
      } while (std::isdigit(c)); 
502.
      // handle remaining y 
503.
      if (read > 0) x = static_cast<integer>(ten_to_read) * x + static_cast<integer>(y); 
504.
      if (negative) x = -x; 
505.
506.
    return i; 
507.
508.
   
509.
} // namespace math
Leider werde ich aus den Fehlern alles andere als schlau (bin auch neu bei C++) Weiss jemand vielleicht irgendetwas, das noch fehlt?

Mit freundlichen Grüßen,
Mathe172
Neuester Wissensbeitrag
Windows 10

Powershell 5 BSOD

(3)

Tipp von agowa338 zum Thema Windows 10 ...

Ähnliche Inhalte
Windows Server
gelöst SQLCMD über BAT aufrufen (Sicherung SQL Server Express 2012 (3)

Frage von joeyschweiz zum Thema Windows Server ...

Windows Server
Server 2012 R2 Cleanmgr.exe mit Systemdateien bereinigen? Wie? (2)

Frage von busteron zum Thema Windows Server ...

Heiß diskutierte Inhalte
LAN, WAN, Wireless
gelöst Server erkennt Client nicht wenn er ausserhalb des DHCP Pools liegt (28)

Frage von Mar-west zum Thema LAN, WAN, Wireless ...

Outlook & Mail
Outlook 2010 findet ost datei nicht (18)

Frage von Floh21 zum Thema Outlook & Mail ...

Windows Server
Server 2008R2 startet nicht mehr (Bad Patch 0xa) (18)

Frage von Haures zum Thema Windows Server ...