You can use the InternetSetCookie() function to set a cookie value that will be picked up by Internet Explorer (but not other browsers). However, as mentioned by bithub, you typically need to logon to get the correct cookie value anyway.
This code seems to work to logon to cboard. You can get the correct value for bbuserid and bbpassword from inside the IE cookie file or from Firefox.
Code:
#include <windows.h>
#include <wininet.h>
#pragma comment(lib, "wininet.lib")
int main (void)
{
InternetSetCookie(TEXT("http://cboard.cprogramming.com"), TEXT("bbuserid"),
TEXT("1001; expires = Sat, 01-Jan-2005 00:00:00 GMT"));
InternetSetCookie(TEXT("http://cboard.cprogramming.com"), TEXT("bbpassword"),
TEXT("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; expires = Sat, 01-Jan-2005 00:00:00 GMT"));
return 0;
}