A
A
AinzO2021-08-07 14:38:37
C++ / C#
AinzO, 2021-08-07 14:38:37

How can this code be implemented without the string library?

Without string
And without deff of course

#include <iostream>
#include <fstream>
#include <string>


using namespace std;
int main()
{
  string i, q;
  ifstream z("onefile.txt"), d("twofile.txt");
  while (getline(z, i) && getline(d, q))
  {
    if (i != q)
      cout << i << endl << q << endl;
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wataru, 2021-08-07
@AinzO

Get char arrays of some sufficient length. Read through gets_s. Compare strings with strcmp.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question