text: Hi,
  I need to do the following:
  - read the text file with names and surnames
  - convert each char to int than add them
  - the number must keep adding each other until it is under 10
  This is what I have so far
  #include <iostream> #include <fstream> #include <cstdlib> #include <string> using namespace std; int main () { char charValue1[1000], charValue2[1000], in_line[15], out_line[15]; int asciiValue, charNum, word = 0; string line; //input and output files ifstream in_stream; ofstream out_stream; cout << "Enter the file name of the input file (max char 14): " << endl; cin >> in_line; cout << in_line << endl; cout << "Enter the file name of the output file (max char 14): " << endl; cin >> out_line; cout << out_line << endl; //open the file in_stream.open(in_line); //Check if the file can be opened if (in_stream.fail()) { cout << "Input file error" << endl; exit(1); } out_stream.open(out_line); //Read the file till EOF while (!in_stream.eof()) { { while (getline(in_stream, line)) { cout << int(charValue1[line]) << endl; cout << charValue1[line] << endl; word++; } } } in_stream.close(); out_stream.close(); return 0; }
  ========================================================================
  the file will contain e.g
  "worda wordb; wordc wordd; worde wordf;"
  for example the program needs to convert the worda and wordb into Ascii numbers and add them e.g
  (w+o+r+d+a) + (w+o+r+d+b) --> keep adding them until the number is less than 10
  for example 1.1
  w = 1, o = 2, r = 3, d = 4, a = 5, b = 6 (w+o+r+d+a) + (w+o+r+d+b) = (1+2+3+4+5) + (1+2+3+4+6) = 15 + 16 = 31 = 4 ( less than 10)
  which will be written into the output file.
  The words will be separated by ";"
  I'm stuck on how to separate the 2 words by ";" and also how to get the 2nd two words after ";" than stop at ";" etc...