How to use MessgeBox with variables

Please you help me with this. I am a beginner to programming !!!

Thank You

1
2
3
4
5
6
7
8
9
#include <Windows.h>
//using namespace std;
void main(void)
{
	int a = 1;
	float b = 2.2;
	MessageBox(NULL, a && b, L"testx", MB_OK);
	// How to input Result variable 'a' & 'b' . 
}


Error :( !
The main function must return int.

You have to convert a and b to strings first.

http://www.cplusplus.com/reference/string/to_string/
http://en.cppreference.com/w/cpp/string/basic_string/to_string

Then the MessageBox function expects you to use .c_str() on the final string.
Last edited on
Topic archived. No new replies allowed.