Hello I an new to C++ and am making my first program from scratch that has a useful solution after a while debugging I notice a problem with a displayed item and so I change the the code and a new error comes up...
------ Build started: Project: A_Message, Configuration: Debug Win32 ------
name.cpp
g:\vs2010projects\a_message\a_message\name.cpp(28): error C2065: 'x' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
My code is like this and I just can't quite fix it...
#include "stdafx.h"
#include "iostream"
int printing();
int naming()
{
using namespace std;
cout << "Enter your name:" << endl;
int x;
cin >> x;
#ifndef USER_NAME
#define USER_NAME x
#endif
printing();
return 0;
}
int printing()
{
using namespace std;
cout << "Hello,"<< USER_NAME << endl;
return 0;
}
All the other code is fine just the #define USER_NAME x is a problem and the error is in Printing() when it tries to find x or something, as I said I'm new to this so any help is appreciated. Im using visual studio express 2010 on windows XP professional SP3
Thanks,
Bobbysmile
(FIles as atachments)