#include <iostream>
#include <Windows.h>

using namespace std;
using std::cout;
using std::endl;


string GetMyComputerName(){
	TCHAR compname[80];
	wstring test = L"";
	DWORD size = sizeof(compname) / sizeof(compname[0]);
	//Get computer name
	GetComputerName(compname,&size);
	//Covert compname to wide string
	test = wstring(&compname[0]);
	//clear
	memset(compname,0,size);
	//Return string from wide string.
	return string(test.begin(),test.end());
}

string GetMyUserName(){
	TCHAR username[80];
	wstring test = L"";
	DWORD size = sizeof(username) / sizeof(username[0]);
	//Get computer name
	GetUserName(username,&size);
	//Covert username to wide string
	test = wstring(&username[0]);
	//clear
	memset(username,0,size);
	//Return string from wide string.
	return string(test.begin(),test.end());
}

int main(){
	cout << "Your Computer Name is: " << GetMyComputerName().c_str() << endl;
	cout << "Your user name is: " << GetMyUserName().c_str() << endl;

	system("pause");
	return 1;
}