Missing function header - help please

I'm just learning how to use c++ and am stuck with why this error keeps coming up saying im missing a function header '{' (old-style formal list?).
please help me understand what i'm missing.

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
 #include <iostream>
#include <string>
#include <sstream>
using namespace std;

struct info {
	string name;
	int age; } mine, yours;
	
	void printinfo (info info1);

	int main () 
	{
	string age1;

	mine.name = "Katie";
	mine.age = 18;

	cout << "Please enter your name: ";
	getline (cin, yours.name);
	cout << "Please enter your age: ";
	getline (cin, age1);
	stringstream(age1) >> yours.age;

	cout << "I am:\n";
	printinfo (mine);
	cout << "You are:\n";
	printinfo (yours);
	return 0; }

	void printinfo (info info1);
	{cout << info1.name;
	cout << " (" << info1.age << ")\n"; }
Last edited on
In this case he is fine because he has defined some instances afterward which include the trailing ';'.

Anyway, your error is on line 31. Your function shouldn't end with a ';' if you are going to define what it does.

Also, your indentation is bleh; hopefully that's just because you editted in the code tags.
Thanks. I've been copying my indentation from the tutorials... any tips??
Topic archived. No new replies allowed.