文字列表現が指定された整数と等しいかどうかを確認しています。私は関数内でこれのためにstringstreamを使うつもりです。私もこのためにoperator=
を持っています。文字列をストリングストリームを使用してintに変換しようとしています
私は一緒に、私は何かが欠けていた場合、これらを実行する方法については少し混乱しています。これは私が持っている課題の最後のビットです。これは私の全プログラムのちょっとしたスニペットです。私はこれについて多くのガイドを見つけることができません、そして、私はそれらがすべて私が使用することを許されていないatoiまたはatodに向けると感じます。
このヘッダーでは、=演算子にどのような引数を使用するのかよくわかりません。申し訳ありません
#include <iostream>
#include <sstream>
#include <string>
#include "Integer.h"
using namespace std;
Integer &Integer::operator=(const string*)
{
this->equals(strOne);
return *this;
}
void Integer::equals(string a)
{
strOne = a;
toString(strOne);
}
string Integer::toString()
{
stringstream ss;
ss << intOne;
return ss.str();
}
#include <iostream>
#include <cstdlib>
#include <conio.h>
#include <string>
#include <ostream>
using namespace std;
#include "Menu.h"
#include "Integer.h"
#include "Double.h"
int main()
{
Integer i1;
i1.equals("33");
cout << i1;
}
その悪い質問は、私はこのタイプの割り当てとあまり慣れていないと私が得ることができる任意の助けを取る場合。ありがとう。