Code:
#include <iostream>
#include <string>
#include <fstream>
#include <array>

#define MYFILE "/Users/peterjocham/Desktop/textfile.txt"

using namespace std;

int main()
{
    ifstream infile(MYFILE,ios::in);
    
    string s;
    int count=0;
    
    getline(infile, s);
    
    for (int i=0; i<sizeof(s);i++)
    {
        if(s[i]=='a'&&'n'&&'d')
        {
            count++;
        }
    }
    
    cout<<"and appeared: "<<count<<" times"<<endl;
    
    
    return 0;
}
I am trying to count how many time the word 'and' occurs but I am getting wrong numbers.