Choice Block

Instructions

1. First try the examples on this page on Interactice C. If you are having trouble, Mikayla can probably help.
2. If you want to play with the crickets when you are done, they are in a cardboard box under my desk. They should be ready go, but the beamers in the box need to be plugged into a USB port. They will only work on the computers that they worked on before.
3. Mikaya, if you want to work on the Create, it is in the blue cabinets in the back of the room, and the part you program I think is in the bottom drawer of the tan filing cabinet.

Introduction to Interactive C

  • Open Interactive C.
  • Choose the XBC-Create
  • Click OK
  • When it is trying to connect to the board, just choose connect later.

Programs to try (You can cut and paste)

void main()
{
printf("Hello, world!\n");
}

  • Press save
  • Press Check
  • Then Press Simulate
  • Click on "Run Main"
  • You should see Hello, world! Printed on the screen.
  • Why don't you see the "\n" printed?
  • Press quit simulator
  • Add another printf statement, like this

void main()
{
printf("Hello, world!\n");
printf("Hello, school\n");
}

  • Again, press save, check, then simulate, and then press "Run Main"
  • Now try it without the \n
  • Press quit simulator
  • Change the program to this

void main()
{
printf("Hello, world!");
printf("Hello, school");
}

  • Again, press save, check, then simulate, and then press "Run Main"
  • Now you can do some math and print an answer

void main()
{
int i;
i = 50 / 4;
printf("The answer is %d\n", i);
}

  • Is the answer to this problem correct? Check with a calculator.
  • How did the computer find the answer?
  • Now try this:

void main()
{
float f;
f = 50.0/4.0;
printf("The answer is %f\n",f);
}

  • What do you think is the difference between float and int?
  • What other math can the the program do?
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License