السلام عليكم ورحمه الله و بركاته
عندي بروجكت مطلوب مني اسوي اله حاسبه باللينكد ليست و اليوزر يقدر يدخل في هاذي الاله ارقام طويله مره
انا توني بالبدايه و طلع لي ايرور وما عرفت ايش هو بالضبط !!!
ياليت احد يساعدني ..
#include<iostream>
#include<string>
using namespace std;
class Calculator
{
public:
int value;
Calculator* next;
Calculator()
{
value=0;
next=NULL;
}
Calculator(int v)
{
value=v;
next=NULL;
}
};
void GetNum(Calculator*& h)
{
string s=" ";
cin>>s;
int n=0;
int strlen=s.length();
for (int i=0; i<strlen; i++)
{
n= s-'0';
AddHead(h,n);
}
}
void Print(Calculator* h)
{
if(!h) cout<<"List is empty\n";
while(h)
{
cout<<h->value;
h=h->next;
}
cout<<endl;
}
void AddHead(Calculator*& h, int n)
{
Calculator* tmp= new Calculator(n);
tmp->next=h;
h=tmp;
}
int main()
{
Calculator* num1=NULL;
Calculator* num2=NULL;
Calculator* result=NULL;
char oper;
while(true)
{
cout<<"Enter the first number:"<<endl;
GetNum(num1);
cout<<"Enter the second number:"<<endl;
GetNum(num2);
}
return 0;
}وشكراً ..