arduino communicate with C++ (code blocks)

I have an Arduino and I would like to communicate with my computer. I would like to use usb (COM3) ( I think it is the easiest way). I use C++ ( Code Blocks) on my computer. I wan't to send an variable from computer to my arduino.

I've written the Arduino code:

// receiver int data;

void setup() { Serial.begin(9600); pinMode (13, OUTPUT); }

void loop() { if (Serial.available()) { data = Serial.read(); if (data==1){ digitalWrite(13, HIGH); delay(100); } } digitalWrite(13, LOW); }

I want to write the sender code in C++ ( Code Blocks) which send an variable (data=1) .

Can you help me?

I think you need to import the serial library. Read here: it could help you.. http://stackoverflow.com/questions/11677639/two-way-c-communication-over-serial-connection

;)