I've been working through the "Programming: Principles and Practice using C++" book, and this example was meant to illustrate how data can be lost in type conversions. But when I tried to execute it, it keeps telling me 'Main' : must return a value. I tried using "return 0;" after the curly brace for the while loop, but then it gave errors around "Unresolved externals".
I've copied the code from the book to Visual Studio and everything else I've copied has worked as expected - would anyone be able to tell me how I could fix this please? I don't know why it's happening with this specific example or how to make it stop asking for a return value.
Sorry if this is dumb, I'm very inexperienced and I've tried googling for an answer, but suggested solutions like "return 0" don't work :)!
#include "std_lib_facilities.h"
int main()
{
double d = 0;
while (cin >> d)
{
int i = d;
char c = i;
int i2 = c;
cout << "d==" << d
<< " i==" << i
<< " i2==" << i2
<< " char(" << c << ")\n";
}
}