Help with solving email problem

Im trying to input a file that contains a list of emails. From that list of emails im trying to decide if each email has 1 '@' symbol. If it doesnt I want to hold on to that email address for a later output of all the invalid email addresses. Im trying to do this with bool statements and pointers only. Im unable to print list of emails with more than 1 or less than 1 "@" symbols. The final output should like this :

*** INVALID ENTRIES ***
5: .m.a.alam@bristol.ac.uk
7: amar@igcar
12: rumenia @rusys.eg.net
13: jeremie@debaerdermaeker@rug.ac.be
15: bba@neu-.edu
18: CDBELING.hkucc
21: @boerner@physik.uni-halle.de
23: BORONSKI@apollo.int.!pan.wroc.pl
26: DTB@physci.uct.ac.



My code so far is :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <fstream>  // for ifstream
#include <cstdlib>  // for exit()
#include <cstring>  // for string-handling functions
using namespace std;


bool oneAt(const char *email); // '@' occurs exactly once


int main(){
	int n;
	const int size = 50;
	char line[size];

	char filename[25]
	ifstream fin;

	cout << "Enter the input file\n";
	cin >> filename;

	fin.open(filename);

	if(fin.fail()){
		cerr << "Input file opening error.\n";
	}
	else{
		cout << "success\n";
	}	

	

	fin.close();
	system("Pause");
	return 0;
}
bool oneAt(const char *email){
	count =  0;
	for (int i = 0; i < size; i++)
		if line[i] == '@'
		count += 1;
	if count > 1
		return false;
	else 
		return true;
}
	
You should try compiling your code first. Get all the errors fixed up and you will find the problem a lot easier.
Topic archived. No new replies allowed.