fork download
  1. #include <iostream>
  2.  
  3. int main() {
  4. std::cout << "Here are some exception handlers to view! Start this with X64dbg then look in the SEH tab.\n";
  5.  
  6. try {
  7. throw "A pointless exception";
  8. }
  9. catch (const char* msg) {
  10. // Catch block for catching exceptions of type const char*
  11. std::cout << "Caught exception: " << msg << std::endl;
  12. }
  13. catch (int x) {
  14. // Catch block for catching exceptions of type int
  15. std::cout << "Caught integer exception: " << x << std::endl;
  16. }
  17. catch (...) {
  18. // Catch block for catching all other types of exceptions
  19. std::cout << "Caught unknown exception" << std::endl;
  20. }
  21.  
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 5296KB
stdin
/*  Berechnung des Hamming-Abstandes zwischen zwei 128-Bit Werten in 	*/
/*	einer Textdatei. 													*/
/*  Die Werte müssen auf einer separaten Zeile gespeichert sein			*/
/* 																		*/
/*	Erstellt: 17.5.2010													*/
/*  Autor: Thomas Scheffler												*/

#include <stdio.h>
#include <stdlib.h>

#define ARRAY_SIZE 32

unsigned Hamdist(unsigned x, unsigned y)
{
  unsigned dist = 0, val = x ^ y;
 
  // Count the number of set bits
  while(val)
  {
    ++dist; 
    val &= val - 1;
  }
 
  return dist;
}



int main (void)
{
	char hex;
	int i;
	int a[ARRAY_SIZE];
	int b[ARRAY_SIZE];
	int hamDist = 0;
	FILE* fp;
	
	//Arrays mit 0 initialisieren
	for (i = 0; i < ARRAY_SIZE; ++i)
	{
  		a[i] = 0;
  		b[i] = 0;
	}

	
	fp = fopen("hex.txt","r");
	if (fp == NULL) 
	{
		printf("Die Datei hex.txt wurde nicht gefunden!");
		exit(EXIT_FAILURE);
	}

	i=0;
	printf("1.Zeile einlesen.\n");

 	while((hex=fgetc(fp))!='\n' && hex != EOF)
    {
        a[i]=strtol(&hex,0,16);
		i++;
    }
	i=0;
	printf("2.Zeile einlesen.\n");

 	while((hex=fgetc(fp))!='\n' && hex != EOF)
    {
    	b[i]=strtol(&hex,0,16);
        i++;
    }
	fclose(fp);

	printf("Hamming-Abweichung pro Nibble:\n");
	for (i = 0; i < ARRAY_SIZE; ++i)
	{
		printf ("%i\t%i\t%i\n",a[i],b[i],Hamdist(a[i],b[i]));
		hamDist += Hamdist(a[i],b[i]);
	}
	printf ("\nHamming-Abweichung der Hash-Werte:%d\n",hamDist);
}

stdout
Here are some exception handlers to view! Start this with X64dbg then look in the SEH tab.
Caught exception: A pointless exception