Need help!

I am currently working on a code for a class I have and have been reading the text book and searching online for a way to get to the solution but so far nothing has made any sense. I need to make a code that can find the remainder of a very large number that is found from a .txt file. I understand the division behind the problem I just dont understand how to put it into code. If someone could give me a push in the right direction that would be amazing.



Problem:
Write program that computes the remainder of very long integer number that cannot be stored in C++ as in int type. You will get this long numbers from input data file and calculate the remainder when this number is divided by 97.

Sample Input:
1234567898765432

22222222222222222222222222222222

3333333333333333333333333333333333333333

3214282912345698765432161182


This is an outline for the code:

#include <cstdlib> //the standard C library header

#include

int main()

{

std::string si = "12";

int i = atoi(si.c_str()); //the c_str() function "converts"

}

//assume that dividend is 9 or more digits long

int main()

{

//variable declarations

int divider=97; //two digit number

int remainder;

string data; // input data

ifstream myIn; //input file

//open data file

myIn.open("longNumber.txt"); //input file name

//first data - priming read

myIn>>data;


while (myIn) //not end of file

{

cout<<" dividend is "<<data<<endl;

//process data -- this may be the focus

//calculate the remainder ( divided by divider)

//complete the code here

//

//

//remainder = ………………


cout<<" remainder is "<<<endl;

//next data to process

myIn>>data;

}

return 0;

}
http://cpp.sh/8aixd

Is what Ive managed so far I just cant figure out where my division went wrong
Thanks for the Help I actually found out the answer myself. I had to set a =0 for it to work fully. and then delete a couple cout statments
Topic archived. No new replies allowed.