Help with headers

Encrypt.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef encrypt
#define encrypt
#include <iostream>
#include <string>
#include <fstream>
#include <conio.h>
using namespace std;

void encrypt(string phrase)
{
     ofstream encrypt("EncryptedTest.dat");
        
     int phraseLength = phrase.size();
        
     for(int i = 0; i < phraseLength; i++)
       {     
          //random code that encrypts the phrase
       }
       encrypt.close();
}
#endif 


Main.cpp

1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include "Encrypt.h"

int main()
{
    string name;
    getline(cin, name);
    
    encrypt(name);
}


It returns an error saying "in Encrypt.h expected ';' or ',' before "phrase".

The phrase it is referring to is the one on the line

void encrypt(string phrase)
#include <conio.h>
you are not using this. so do not include them
string name;needs to be std::string

the header's function's formal argument asks for a std::string you are giving it a string, not an std::string
Unfortunately, that didn't solve the problem.
try
void encrypt(std::string phase)
Topic archived. No new replies allowed.