C ++ Practice
Copyright (C) 2014-2018 Wonder Diaz
Algorithms practices in C ++ grouped in a project created with IDE Zinjai. This project is carried out for educational purposes, in order to develop simple codes. Any improvement or error found to notify it.
Registration of changes
Simple structures algorithms
- Read the name and age of any person and print age
- Print your name, age, sex, and marital status
- Read the name and age of any person and print if and only if the person is a minor a message that says 'cannot vote'
- Read the name and age of any person and print only if the person is of legal age, the person's name
- Read two numbers and print only the positive
- Read two numbers calculate the sum and print the sum and the numbers read
- Read two numbers and print both numbers if at least one of them is positive
- Read two numbers and print both numbers only if they are of a different sign and different from zero
- Read a number and calculate and print the square of the number and its square root. If the number is negative, print the number, the square of the number and a message that says 'has an imaginary root'
- Get the highest number of any three numbers
- Read the name of an employee, the basic salary per hour and the number of hours worked during the week. Calculate the net salary, taking into account that if the number of hours worked during the week is greater than 48, those hours are considered overtime and have a 35% surcharge. Print the name of the employee and the net salary
- Read the name and age of any person and print only if the person is of legal age, the name of the person, otherwise, print a message that says 'cannot vote'
- Read the name, age and sex of any person and print, only if the person is male and of legal age, the name of the person.
- Read the name, age, sex and marital status of any person and print only if the person is a single man of legal age, the name of the person.
- Read two numbers, calculate the sum of the numbers and print the numbers read and only if the sum is negative imprimel it too
- Read the name, sex and marital status of any person and prints, only if the person is a man or minor women or a man married to any age, the name of the person and a message that says 'you are not sent'
- Read two numbers and calculate the ratio of dividing the first by the second, print the quotient. If the second is zero, do not execute the calculation and print a message that says: 'The division is not possible'
- Read a number and print the number and the absolute value of the same
- Read the name of an employee, his basic salary per hour and the number of hours worked in the month. Calculate your monthly salary and print both the name and your monthly salary. Note: Monthly salary = basic salary per hour * Number of hours worked in the month.
- Read a number and calculate and print your square root. If the number is negative, print the number and a message that says 'has an imaginary root'
- Read a number and calculate 5% of the number read. Obtain both the number and the calculated percentage.
- Read the name of an employee, his basic salary per hour, the number of hours worked in the period and the retention percentage at the source. Calculate the gross salary, the retention value and its net salary. Note: Gross Salary = Basic Salary per hour Number of hours worked in the period, retention value = Gross Salary Retention Percentage, Net Salary = Gross Salary - Retention Value
- For a gross salary of up to 75,000 Bs. There is no retention. For a gross salary of 75,000Bs to 150,000Bs the retention percentage is 5%. For a gross salary greater than 150,000Bs the percentage and retention is 8%. Obtain the name of the employee, the gross salary, the value of retention and net salary. The name and gross salary should be read. Note: Retention value = gross salary * Retention percentage, net salary = gross salary - retention value.
- Design an algorithm, which allows the dividend and divisor to enter and then calculate the residue and the quotient of said division.
- Design an algorithm to calculate and write the square of 243.
- Design an algorithm that exchanges the values of two numerical variables.
- Design an algorithm that allows an initial value and then a final value, and then calculate the central value of the numbers
- Find out if given two numbers, one is a divisor of another.
- Design an algorithm that allows to determine if a number entered from the keyboard is a torque or odd number
- Make an algorithm that allows you to enter a certain number of seconds and turn it into hours, minutes and seconds.
- Make an algorithm that allows you to enter the time, minutes and seconds and indicate how many seconds are they.
- Design an algorithm that allows you to enter the hour, minutes and seconds and calculate the time in the next second ("0 = <h = <23", "0 = <m = <59" "0 = <s = <59").
- Make the design of an algorithm that allows: Enter the work code, enter number of hours worked, enter the cost of the hour, calculate the gross weekly salary, calculate the weekly net salary, print the gross salary and the net salary, respective (gross salary less the pension insurance discount 11%)
- Write an algorithm that determines if a year is leap. A year is leap if it is a multiple of 4 (for example, 1984). The multiples of 100 are not leaps, except if they are also multiples of 400 (2000 is leap, but; 1800 is not).
- Given to, B determine the value of the entire division and the rest of the entire division of A, B (using div. Or mod operators)
- Design an algorithm that determines the price of a round trip ticket, giving the distance to travel and the number of days at destination, knowing that if the stay is greater than 7 days and the distance is greater than 800 km. The ticket has a 30%reduction. The price per kilometer is 85 Bs.
- Given the duration (in minutes) of a phone call, calculate its cost, as follows: up to 5 min. The cost is 0.90. Above 5 min. The cost is 0.90+0.20 for each additional minute to the first 5 min.
Cycling algorithms
- Obtain the even numbers between 20 and 400
- Read the name, age, sex and marital status of 20 people and print the name of the person if and only if he is a man, of legal age.
- Obtain and print the sum of the multiples of 2 between m and n
- Read a number and get the multiples of 3 between 1 and the number read
- Build a table of values of the function y = x² + 3*x - 7 from x = 1 to x = 250 increasing 10 in 10 in 10
- Calculate the sum of the first 100 natural numbers
- It is required to know about 35 students in each poor category (n <2) insufficient (2 <o = n <4) sufficient (4 <o = n <5) well (5 <o = n <6) remarkable (6 <o = n <8) outstanding (8 <o = n)
- Show the first 30 powers of 3 and the sum of them.
- Find the average rating for a large number, although unknown exam rates.
- A man plans to invest 500,000 Bs. Per year at 6% interest. How many years would require to accumulate 100,000,000 Bs. The year in which it exceeds 100,000,000 Bs must be obtained.
- A certain university is interested in knowing the average qualification of the students who received Spanish during a semester. You also want to know the total number of students who failed. Calculate the above, taking into account that the qualifications are read.
- Read a series of numbers and obtain the largest number from each pair. Print a special message if the numbers are of equal value.
- A library estimates the prices of your books as follows: the basic price of a book is 5,000 Bs. Plus 200 Bs. Per page. However, if the number of pages exceeds 550 the price increases by another 750bs. The book code and the number of pages must be read. It is necessary to calculate and print the code and the price of each of the books.
Donation