#include "stdafx.h"
#include "io.h"
int main()
{
int x = ReadNumber();
int y = ReadNumber();
WriteAnswer(x+y);
return 0;
}
io.h:
1 2 3 4 5 6 7
#ifndef IO_H
#define IO_H
int ReadNumber();
void WriteAnswer(int x);
#endif
io.cpp:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include "stdafx.h"
#include <iostream>
int ReadNumber()
{
usingnamespace std;
cout << "Enter a number: ";
int x;
cin >> x;
return x;
}
void WriteAnswer(int x)
{
usingnamespace std;
cout << "The answer is " << x << endl;
}
This whoden work if i dident add #include "io.h" to the "stdafx.h" file.
1 2 3 4 5 6 7 8 9 10 11 12
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include "io.h"
// TODO: reference additional headers your program requires here
As you probely already guest i`am using VS C++ Express.
So if i where using a difrent IDE like CodeBlocks ore some other IDE.
Whode i stile get the same "problem" ?
Sorry for my bad gramma.
And Thanks to all that takes the time.