Esempio n. 1
0
/*The main function - the program starts executing here
The main function takes no parameters and returns an integer.*/
int main(void)
{
	double number_a, number_b, number_c, a_squared, b_squared;

	display_welcome();

	printf("Please enter an integer number representing a kathete of a right \nsided triangle: ");
    number_a = get_double();
    printf("Please enter an integer number representing a kathete of a right \nsided triangle: ");
    number_b = get_double();

    a_squared = pow(number_a, 2);
    b_squared = pow(number_b, 2);

	number_c = sqrt(a_squared + b_squared);

	printf("Kathetes %.1lf and %.1lf in a right angled triangle gives hypotenuse = %.2lf\n", number_a, number_b, number_c);

	return 0;
}
Esempio n. 2
0
int
main(int argc, char *argv[])
{
  LIRCServer lirc_server;
  LIRCSettings lirc_settings;

  /* Display a welcome message to the console. */
  display_welcome();

  /* Set up the LIRC server */
  lirc_server_init(&lirc_server, &lirc_settings);

  /* Enter the main loop of the server application */
  while (TRUE)
  {
    lirc_server_main_loop(&lirc_server, &lirc_settings);
  }

  printf ("Server is shutting down.\n");
  lirc_server_close(&lirc_server);
  lirc_settings_destroy(&lirc_settings);
  return EXIT_SUCCESS;
}
Esempio n. 3
0
static void menu_start (GcomprisBoard *agcomprisBoard)
{

    current_x = 0.0;
    current_y = 0.0;

    /* initialisations */
    /* in case we will make this parametrable */

    panel_x = P_X;
    panel_y = P_Y;
    panel_w = P_W;
    panel_h = P_H;

    top_x = T_X;
    top_y = T_Y;
    top_w = T_W;
    top_h = T_H;
    top_int_x = T_INT_X;
    top_arrow_size = T_ARROW_SIZE;

    display_x = D_X;
    display_y = D_Y;
    display_w = D_W;
    display_h = D_H;
    display_int_x = D_INT_X;
    display_int_y = D_INT_Y;

    info_x = I_X;
    info_y = I_Y;
    info_w = I_W;
    info_h = I_H;

    icon_size = ICON_SIZE;
    icon_size_panel = ICON_SIZE_PANEL;
    icon_size_top = ICON_SIZE_TOP;

    if(agcomprisBoard != NULL)
    {
        RsvgHandle *svg_handle;

        gcomprisBoard=agcomprisBoard;

        /* set initial values for this level */
        gcomprisBoard->level = 1;
        gcomprisBoard->maxlevel=1;

        /* Set back the bar to it's original location */
        gc_bar_set(GC_BAR_CONFIG|GC_BAR_ABOUT|GC_BAR_JOURNAL|GC_BAR_SHARE);

        menuitems = g_new(MenuItems, 1);

        svg_handle = gc_skin_rsvg_get();

        gc_set_background_by_id (goo_canvas_get_root_item(gcomprisBoard->canvas),
                                 svg_handle,
                                 "#BACKGROUND");

        boardRootItem = \
                        goo_canvas_group_new (goo_canvas_get_root_item(gcomprisBoard->canvas),
                                              NULL);

        g_object_set_data_full(G_OBJECT (boardRootItem),
                               "menuitems", menuitems, g_free);

        goo_canvas_svg_new (boardRootItem,
                            svg_handle,
                            "svg-id", "#SELECTOR",
                            "pointer-events", GOO_CANVAS_EVENTS_NONE,
                            NULL);

        goo_canvas_svg_new (boardRootItem,
                            svg_handle,
                            "svg-id", "#BUTTON_HORIZONTAL",
                            "pointer-events", GOO_CANVAS_EVENTS_NONE,
                            NULL);

        create_info_area(boardRootItem, menuitems);

        create_panel(boardRootItem);

        if (menu_position)
            display_section(menu_position);
        else
            display_welcome(menuitems);

        {
            if ( strcmp(gc_prop_get()->profile->name, GC_PROFILE_DEFAULT) != 0 )
            {
                gchar *text = g_strdup_printf(_("Profile: %s"),
                                              gc_prop_get()->profile->name);
                goo_canvas_text_new (boardRootItem,
                                     text,
                                     BOARDWIDTH - 10,
                                     BOARDHEIGHT - 30,
                                     -1,
                                     GTK_ANCHOR_EAST,
                                     "font", gc_skin_font_board_tiny,
                                     "fill-color-rgba", gc_skin_get_color("menu/text"),
                                     "alignment", PANGO_ALIGN_RIGHT,
                                     NULL);
                g_free(text);
            }
        }

        {
            gchar *text = g_strdup_printf(_("Number of activities: %d"),
                                          gc_board_get_number_of_activity());
            goo_canvas_text_new (boardRootItem,
                                 text,
                                 BOARDWIDTH - 10,
                                 BOARDHEIGHT - 10,
                                 -1,
                                 GTK_ANCHOR_EAST,
                                 "font", gc_skin_font_board_tiny,
                                 "fill-color-rgba", gc_skin_get_color("menu/text"),
                                 "alignment", PANGO_ALIGN_RIGHT,
                                 NULL);
            g_free(text);
        }

        menu_pause(FALSE);

    }

}