Networking
Simple Usage Examples
Dec To Hex
Simple Decimal to Hexadecimal Converter
The following code shows examples of using dec to hex to convert a decimal value to a hex value.
#include "splashkit.h"
int main(){ write_line("Hello! Welcome to the decimal to hexadecimal converter.");
// Prompt the user for a decimal input write_line("Please enter a decimal number:");
// Read the input as a string string dec_input = read_line();
// Convert the input string to an unsigned integer unsigned int dec_value = convert_to_integer(dec_input);
// Convert the decimal value to hexadecimal format string hex_value = dec_to_hex(dec_value);
// Display the result in hexadecimal format write_line("The decimal value in hexadecimal format is: " + hex_value);
return 0;}using static SplashKitSDK.SplashKit;
WriteLine("Hello! Welcome to the decimal to hexadecimal converter.");
// Prompt the user for a decimal inputWriteLine("Please enter a decimal number:");
// Read the input as a stringstring dec_input = ReadLine();
// Convert the input string to an unsigned integeruint dec_value = Convert.ToUInt32(dec_input);
// Convert the decimal value to hexadecimalstring hex_value = DecToHex(dec_value);
// Display the resultWriteLine("The decimal value in hexadecimal format is: " + hex_value);from splashkit import *
write_line("Hello! Welcome to the decimal to hexadecimal converter.")
# Prompt the user for a decimal inputwrite_line("Please enter a decimal number:")
# Read the input from the userdec_input = read_line()
# Convert the input string to an unsigned integerdec_value = convert_to_integer(dec_input)
# Convert the decimal value to hexadecimalhex_value = dec_to_hex(dec_value)
# Display the result in hexadecimal formatwrite_line(f"The decimal value in hexadecimal format is: {hex_value}")Output:

Hex To Dec String
Simple Hexadecimal to Decimal String Converter
The following code shows examples of using hex to dec string to convert a hex value into a decimal string.
#include "splashkit.h"
int main(){ write_line("Hello! Welcome to the hexadecimal to decimal converter.");
// Prompt the user for a hexadecimal input write_line("Please enter a hexadecimal number:");
// Read the input as a string string hex_input = read_line();
// Convert the hexadecimal string to a decimal string string dec_value = hex_to_dec_string(hex_input);
// Display the result in decimal format write_line("The hexadecimal value in decimal format is: " + dec_value);
return 0;}using static SplashKitSDK.SplashKit;
WriteLine("Hello! Welcome to the hexadecimal to decimal converter.");
// Prompt the user for a hexadecimal inputWriteLine("Please enter a hexadecimal number:");
// Read the input as a stringstring hex_input = ReadLine();
// Convert the hexadecimal string to decimalstring dec_value = HexToDecString(hex_input);
// Display the resultWriteLine("The hexadecimal value in decimal format is: " + dec_value);from splashkit import *
write_line("Hello! Welcome to the hexadecimal to decimal converter.")
# Prompt the user for a hexadecimal inputwrite_line("Please enter a hexadecimal number:")
# Read the input from the userhex_input = read_line()
# Convert the hexadecimal string to decimaldec_value = hex_to_dec_string(hex_input)
# Display the result in decimal formatwrite_line(f"The hexadecimal value in decimal format is: {dec_value}")Output:

Ipv4 To Dec
Simple IPv4 To Decimal Converter
The following code shows examples of using IPv4 to Dec to convert an IP address into decimal form.
#include "splashkit.h"
int main(){ write_line("Hello! Welcome to the IP to decimal converter.");
// Prompt the user for an IP input in dotted decimal format (e.g., 127.0.0.1) write_line("Please enter an IPv4 address in dotted decimal format (e.g., 127.0.0.1):");
// Read the input as a string string ip_input = read_line();
// Convert the IPv4 string to a decimal unsigned int ip_as_dec = ipv4_to_dec(ip_input);
// Display the result write_line("The IP address in decimal format is: " + std::to_string(ip_as_dec));
return 0;}using static SplashKitSDK.SplashKit;
WriteLine("Hello! Welcome to the IP to decimal converter.");
// Prompt the user for an IP input in dotted decimal format (e.g., 127.0.0.1)WriteLine("Please enter an IPv4 address in dotted decimal format (e.g., 127.0.0.1):");
// Read the input as a stringstring ip_input = ReadLine();
// Convert the IPv4 string to a decimaluint ip_as_dec = Ipv4ToDec(ip_input);
// Display the resultWriteLine("The IP address in decimal format is: " + ip_as_dec);from splashkit import *
write_line("Hello! Welcome to the IP to decimal converter.")
# Prompt the user for an IP input in dotted decimal format (e.g., 127.0.0.1)write_line("Please enter an IPv4 address in dotted decimal format (e.g., 127.0.0.1):")
# Read the input from the userip_input = read_line()
# Convert the IPv4 string to a decimalip_as_dec = ipv4_to_dec(ip_input)
# Display the result in decimal formatwrite_line(f"The IP address in decimal format is: {ip_as_dec}")Output:

Ipv4 To Hex
Simple IPv4 To Hex Converter
The following code shows examples of using IPv4 to Hex to convert an IP address into hex form.
#include "splashkit.h"
int main(){ write_line("Hello! Welcome to the IP to hexadecimal converter.");
// Prompt the user for an IP input in dotted decimal format (e.g., 127.0.0.1) write_line("Please enter an IPv4 address in dotted decimal format (e.g., 127.0.0.1):");
// Read the input as a string string ip_input = read_line();
// Convert the IPv4 string to hexadecimal format string ip_as_hex = ipv4_to_hex(ip_input);
// Display the result in hexadecimal format write_line("The IP address in hexadecimal format is: " + ip_as_hex);
return 0;}using static SplashKitSDK.SplashKit;
WriteLine("Hello! Welcome to the IP to hexadecimal converter.");
// Prompt the user for an IP input in dotted decimal format (e.g., 127.0.0.1)WriteLine("Please enter an IPv4 address in dotted decimal format (e.g., 127.0.0.1):");
// Read the input as a stringstring ip_input = ReadLine();
// Convert the IPv4 string to hexadecimalstring ip_as_hex = Ipv4ToHex(ip_input);
// Display the resultWriteLine("The IP address in hexadecimal format is: " + ip_as_hex);from splashkit import *
write_line("Hello! Welcome to the IP to hexadecimal converter.")
# Prompt the user for an IP input in dotted decimal format (e.g., 127.0.0.1)write_line("Please enter an IPv4 address in dotted decimal format (e.g., 127.0.0.1):")
# Read the input from the userip_input = read_line()
# Convert the IPv4 string to hexadecimalip_as_hex = ipv4_to_hex(ip_input)
# Display the result in hexadecimal formatwrite_line(f"The IP address in hexadecimal format is: {ip_as_hex}")Output:
