Docsity
Docsity

Prepara tus exámenes
Prepara tus exámenes

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity


Consigue puntos base para descargar
Consigue puntos base para descargar

Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium


Orientación Universidad
Orientación Universidad


Concepto de Lenguaje C++, Ejercicios de Ingeniería

Concepto y ejercicios para llevar a cabo el desarrollo de habilidades con el lenguaje de programacion de C++

Tipo: Ejercicios

2023/2024

Subido el 28/09/2023

wilson-florez-3
wilson-florez-3 🇨🇴

1 documento

1 / 78

Toggle sidebar

Esta página no es visible en la vista previa

¡No te pierdas las partes importantes!

bg1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e

Vista previa parcial del texto

¡Descarga Concepto de Lenguaje C++ y más Ejercicios en PDF de Ingeniería solo en Docsity!

C++

Beginners to Advance www.genial-code.com

Programming!

Objectives

  • Become familiar with the basic components of a C++ program, including functions, special symbols, and identifiers
  • Explore simple data types
  • Discover how to use arithmetic operators
  • Examine how a program evaluates arithmetic expressions

Objectives (continued)

  • Learn how to use preprocessor directives and why they are necessary
  • Explore how to properly structure a program, including using comments to document a program
  • Learn how to write a C++ program 4

The Basics of a C++ Program

  • Function: collection of statements; when executed, accomplishes something - May be predefined or standard
  • Syntax: rules that specify which statements (instructions) are legal
  • Programming language: a set of rules, symbols, and special words
  • Semantic rule: meaning of the instruction 5

Special Symbols

  • Special symbols
        • /. ; 7 ? , <= != ==

      =

Reserved Words (Keywords)

  • Reserved words, keywords, or word symbols
    • Include:
      • int
      • float
      • double
      • char
      • const
      • void
      • return 8

Identifiers (continued)

  • The following are legal identifiers in C++:
    • first
    • conversion
    • payRate 10

Whitespaces

  • Every C++ program contains whitespaces
    • Include blanks, tabs, and newline characters
  • Used to separate special symbols, reserved words, and identifiers
  • Proper utilization of whitespaces is important
    • Can be used to make the program readable 11

Simple Data Types

  • Three categories of simple data
    • Integral: integers (numbers without a decimal)
    • Floating-point: decimal numbers
    • Enumeration type: user-defined data type 13

Simple Data Types (continued)

  • Integral data types are further classified into nine categories: C++ Programming: From Problem Analysis to Program Design, Fourth Edition 14

int Data Type

  • Examples:
    • 6728 0 78
    • 763
  • Positive integers do not need a + sign
  • No commas are used within an integer
    • Commas are used for separating items in a list C++ Programming: From Problem Analysis to Program Design, Fourth Edition 16

bool Data Type

  • bool type
    • Two values: true and false
    • Manipulate logical (Boolean) expressions
  • true and false are called logical values
  • bool, true, and false are reserved words C++ Programming: From Problem Analysis to Program Design, Fourth Edition 17

Floating-Point Data Types

  • C++ uses scientific notation to represent real numbers (floating-point notation) C++ Programming: From Problem Analysis to Program Design, Fourth Edition 19

Floating-Point Data Types

(continued)

  • float: represents any real number
    • Range: - 3.4E+ 38 to 3.4E+ 38 (four bytes)
  • double: represents any real number
    • Range: - 1.7E+ 308 to 1.7E+ 308 (eight bytes)
  • On most newer compilers, data types double and long double are same C++ Programming: From Problem Analysis to Program Design, Fourth Edition 20