All pastes #402951 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-03-20 02:28 UTC
rendered paste body
#include <iostream>
#include <string>

using namespace std;

/*

cmpsc101
3.19.07

homework assignment on writing a sample array

Algorithm is going to be a sort of reverse logic 
with a string implementation for the numbers as
i thouhg char would be harder to do.



*/

string Sum(string arrNum1, string arrNum2);
string ReverseString(string str);

int main ()
{

}

string ReverseString(string str)
{
    string strTemp;
    int Len = str.length() - 1;

    for(int i = 0; i <= Len; i++)
    {
         strTemp += (string) str[Len - i]
    }
    
    return strTemp;
}
string Sum (string arrNum1, string arrNum2)
{
     string Num1 = ReverseString(arrNum1);
     string Num2 = ReverseString(arrNum2);
     int Carry;

     if(Num1.length() < Num2.length())
     {
          string Temp = Num2;
          Num2 = Num1;
          Num1 = Temp;
     }
}