Calculator in C++

This is my calculator in C++ with in-line assembler:

#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main( void )
{
	int nZahl1 = 0, nZahl2 = 0, nVar3 = 0;string strOp="";
do{
	
   	cout << "calculate (+,-,*,/) :" ;
   	cin >> strOp;

   	cout << "number  1: " ;
   	cin >> nZahl1;
	
   	cout << "number  2: " ;
   	cin >> nZahl2;

	if("+"==strOp){
	asm("ADD %%edx, %%eax \n":"=a"(nZahl1):"d"(nZahl2),"a"(nZahl1));
	cout <<" = "<<(nZahl1)<<endl;
	}else if("-"==strOp){
	asm("SUB %%edx, %%eax \n":"=a"(nZahl1):"d"(nZahl2),"a"(nZahl1));
	cout <<" = "<<(nZahl1)<<endl;
	}else if("*"==strOp){
	asm("MOV %%edx, %%eax \n":"=a"(nVar3):"d"(nZahl1),"a"(nVar3));
	for(int i = 2 ;i<=nZahl2;i++)
	asm("ADD %%edx, %%eax \n":"=a"(nZahl1):"d"(nVar3),"a"(nZahl1));
	cout <<" = "<<(nZahl1)<<endl;
	}else if("/"==strOp){
	asm("MOV %%edx, %%eax \n XOR  %%edx,%%edx \n":"=a"(nVar3),"=d"(nZahl1):"d"(nZahl1),"a"(nVar3));
	for(int i = nZahl2 ;nVar3>=i;nZahl1++)
	asm("SUB %%edx, %%eax \n":"=a"(nVar3):"d"(nZahl2),"a"(nVar3));
	cout <<" = "<<(nZahl1)<<",";
	for(int i = 0 ;i<=10;i++){
	nVar3*=10;nZahl1=0;
	for(int i = nZahl2 ;nVar3>=i;nZahl1++)
	asm("SUB %%edx, %%eax \n":"=a"(nVar3):"d"(nZahl2),"a"(nVar3));
	cout <<(nZahl1);
	}
	cout << endl;
	}

}while(1);

return(0);
}

Compile the code:

g++ -o main test.cpp
./main

output:

calculate (+,-,*,/) :+ 
number  1: 4           
number  2: 5           
 = 9                   
calculate (+,-,*,/) :- 
number  1: 9           
number  2:             
4                      
 = 5                   
calculate (+,-,*,/) :^C
sh-4.3# main           
calculate (+,-,*,/) :+ 
number  1: 4           
number  2: 5           
 = 9                   
calculate (+,-,*,/) :- 
number  1: 9           
number  2: 4           
 = 5                   
calculate (+,-,*,/) :* 
number  1: 4           
number  2: 5           
 = 20                  
calculate (+,-,*,/) :/ 
number  1: 20          
number  2: 4           
 = 5,00000000000

Arduino C Program LED Blink

I wrote a little example Arduino C Program that lets the LEDs blink in 5 different ways. You could download the Software from Arduino – Software.

// the setup routine runs once when you press reset:
#define START_PIN 0
#define END_PIN 7

void setup() {                
  // initialize the digital pin as an output.
  for(int i = 0;i<=END_PIN;i++){
  pinMode(i, OUTPUT); 
  }  
}
int sleep = 40;
// the loop routine runs over and over again forever:
void loop() { 
  //mod 1
  for(int i = START_PIN;i<=END_PIN;i++){
  digitalWrite(i, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(sleep);               // wait for a second
  digitalWrite(i, LOW);    // turn the LED off by making the voltage LOW
  delay(sleep);               // wait for a second
  }
  for( int i = END_PIN;i>START_PIN;i--){
  digitalWrite(i, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(sleep);               // wait for a second
  digitalWrite(i, LOW);    // turn the LED off by making the voltage LOW
  delay(sleep);               // wait for a second
  }
  //mod 2
  for( int i = START_PIN;i<=END_PIN;i++){
    digitalWrite(i, HIGH);
  delay(sleep);  
  }
  for( int i = START_PIN;i<=END_PIN;i++){
  digitalWrite(i, LOW);
  }
  for( int i = END_PIN;i>START_PIN;i--){
  digitalWrite(i, HIGH); 
  delay(sleep); 
  }
  for( int i = START_PIN;i<=END_PIN;i++){
  digitalWrite(i, LOW);
  }
  //mod 3
  for(int x = 1;x<=START_PIN+END_PIN;x++){
    for( int i = START_PIN;i<=END_PIN;i++){
    digitalWrite(i, HIGH);
    }
    delay((sleep*10)/x);
    for( int i = START_PIN;i<=END_PIN;i++){
    digitalWrite(i, LOW);
    }
    delay((sleep*10)/x);
  }
  //mod 4
  for(int x = 0;x<=20;x++){
    for( int i = START_PIN;i<=END_PIN;i++){
      if(i%2){
        digitalWrite(i, HIGH);
      }else{
        digitalWrite(i, LOW);
      }
    }
    delay(sleep);
      for( int i = START_PIN;i<=END_PIN;i++){
      if(i%2){
        digitalWrite(i, LOW);
      }else{
        digitalWrite(i, HIGH);
      }
    }
    delay(sleep);
  }
  for( int i = START_PIN;i<=END_PIN;i++){
        digitalWrite(i, LOW);
    }
  //mod 5
  for(int i = 0,a=START_PIN+1,b=END_PIN;i<=20;i++,a++,b--){
    if(a >= END_PIN)a=START_PIN+1;
    if(b <= 6)b=END_PIN+START_PIN;
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  delay(sleep);
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  delay(sleep);
  }
}