Календарь
« Июнь 2018 » |
Пн |
Вт |
Ср |
Чт |
Пт |
Сб |
Вс |
| | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
|
Главная » 2018 » Июнь » 23
Modify the function created in Exercise "Square of Asterisks" to form the square out of whatever character is contained in character parameter fillCharacter. Thus if side is 5 and fillCharacter is “#”, then this function should print
Измените функцию, созданную в задаче "Square of Asterisks" таким образом, чтобы она формировала квадрат для любых символов, содержащихся в символьном параметре fillCharacter. Например, если side равно 5, то функция выведет следующее:
#####
...
Читать дальше »
Категория:
C (задачи)
|
Просмотров:
321
|
Добавил:
alex
|
Дата:
23.06.2018
|
Write a function that displays a solid square of asterisks whose side is specified in integer parameter side. For example, if side is 4, the function displays.
Напишите функцию, которая выводит у левой границы экрана сплошной квадрат из символов *, сторона которого определяется целым параметром side. Например, если side равно 4, функция выведет следующее изображение:
****
****
****
****
#include <stdio.h>
void isSquare(int);
int main()
{
int asterisks;
puts("Enter asterisks:");
scanf("%d", &asterisks);
isSquare(asterisks);
}
void isSquare(int ast)
{
for(int i = 1; i <= ast; i ++)
{
for(int j = 1; j <= ast; j ++)
{
&
...
Читать дальше »
Категория:
C (задачи)
|
Просмотров:
404
|
Добавил:
alex
|
Дата:
23.06.2018
|
Write a program that inputs a series of integers and passes them one at a time to function isEven, which uses the remainder operator to determine whether an integer is even. The function should take an integer argument and return 1 if the integer is even and 0 otherwise.
Напишите программу, которая вводит последовательность целых чисел и передает их по одному функции isEven, которая использует операцию деления по модулю, чтобы определить, является ли целое четным. Функция должна получать один аргумент и возвращать 1, если целое четно, и 0 в противном случае.
#include <stdio.h>
int isEven(int);
int main()
{
int number;
puts("Enter number:(Exit: 0)");
scanf("%d", &number);
while(number != 0)
{
if(isEven(number) == 1)
...
Читать дальше »
Категория:
C (задачи)
|
Просмотров:
319
|
Добавил:
alex
|
Дата:
23.06.2018
|
Write a function isMultiple that determines for a pair of integers whether the second integer is a multiple of the first. The function should take two integer arguments and return 1 (true) if the second is a multiple of the first, and 0 (false) otherwise. Use this function in a program that inputs a series of pairs of integers.
Напишите функцию isMultiple для двух целых, которая передает, кратно ли второе число первому. Функция должна получать два целых аргумента и возвращать 1(true), если второе число кратно первому, и 0(false) в противном случае. Используйте эту функцию в программе, которая вводит серию пар целых чисел.
#include <stdio.h>
#include <stdbool.h>
bool isMultiple(int, int);
int main()
{
int integer1, integer2;
puts("Enter integer1(enter - 0)");
scanf("%d", &integer1);
...
Читать дальше »
Категория:
C (задачи)
|
Просмотров:
306
|
Добавил:
alex
|
Дата:
23.06.2018
|
Write a function integerPower(base, exponent) that returns the value of baseexponent. For example, integerPower(3, 4) = 3 * 3 * 3 * 3. Assume that exponent is a positive, nonzero integer, and base is an integer. Function integerPower should use for to control the calculation. Do not use any math library functions.
Напишите функцию integerPower(base, exponent), которая возвращает значение baseexponent. Например, integerPower(3, 4) = 3 * 3 * 3 * 3. Предположим, что exponent является положительным ненулевым целым, а base целым. Для управления вычислением функция integerPower должна применять цикл for. Не используйте никаких функций математической библиотеки.
#include <stdio.h>
int integerPower(int, int);
int main()
{
int base, exponent;
puts("Enter base:"
...
Читать дальше »
Категория:
C (задачи)
|
Просмотров:
200
|
Добавил:
alex
|
Дата:
23.06.2018
|
Define a function called hypotenuse that calculates the length of the hypotenuse of a right triangle when the other two sides are given. The function should take two arguments of type double and return the hypotenuse as a double.
Определите функцию hypotenuse, которая вычисляет длину гипотенузы прямоугольного треугольника по двум другим сторонам. Используйте эту функцию в программе для определения длины гипотенузы треугольников, приведенных ниже. Функция должна получать два аргумента типа double и возвращать значение гипотенузы также типа double.
...
Читать дальше »
Категория:
C (задачи)
|
Просмотров:
207
|
Добавил:
alex
|
Дата:
23.06.2018
| |
|