free(current);
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#define TSIZE 45
struct film
{
char title[TSIZE];
int rating;
struct film * next;
};
char * s_gets(char * str, int n);
int main(int argc, char * argv[])
{
struct film * head = NULL;
struct film * prev, *current;
char input[TSIZE];
puts("Input first name of movie: ");
while (s_gets(input, TSIZE) != NULL && input[0] != '\0')
{
current = (struct film *) malloc(sizeof(struct film));
if (head == NULL)
head = current;
else
prev->next = current;
current->next = NULL;
strcpy(current->title, input);
puts("Input your rating: ");
scanf("%d", ¤t->rating);
while (getchar() != '\n')
continue;
puts("Input the next name of movie: ");
prev = current;
}
if (head == NULL)
printf("Data not found");
else
printf("List of movies:\n");
current = head;
while (current != NULL)
{
printf("Movie: %s, rating: %d\n", current->title, current->rating);
current = current->next;
}
current = head;
while (current != NULL)
{
auto next = current->next;
free(current);
current = next;
}
printf("The programm is completed.\n");
_getch();
return 0;
}
char * s_gets(char * str, int n)
{
char * value;
char * find;
value = fgets(str, n, stdin);
if (value)
{
find = strchr(str, '\n');
if (find)
*find = '\0';
else
while (getchar() != '\n')
continue;
}
return value;
}
PHP received mixed reviews due to lacking native Unicode support at the core language level.[32][33] In 2005, a project headed by Andrei Zmievski was initiated to bring native Unicode support throughout PHP, by embedding the International Components for Unicode (ICU) library, and representing text strings as UTF-16 internally.[34] Since this would cause major changes both to the internals of the language and to user code, it was planned to release this as version 6.0 of the language, along with other major features then in development.[35]
However, a shortage of developers who understood the necessary changes, and performance problems arising from conversion to and from UTF-16, which is rarely used in a web context, led to delays in the project.[36] As a result, a PHP 5.3 release was created in 2009, with many non-Unicode features back-ported from PHP 6, notably namespaces. In March 2010, the project in its current form was officially abandoned, and a PHP 5.4 release was prepared containing most remaining non-Unicode features from PHP 6, such as traits and closure re-binding.[37] Initial hopes were that a new plan would be formed for Unicode integration, but as of 2014 none have been adopted.
isProductModalOpen (true / false)
. Этот код находится в "контейнере", приконекченном к redux.OPEN_PRODUCT_MODAL
+ айдишник товара (который будете запрашивать с сервера) или + всю инфу о товаре, если она у вас уже есть и вам ничего не нужно запрашивать.admin.auth().deleteUser(uid)
.then(function() {
console.log("Successfully deleted user");
})
.catch(function(error) {
console.log("Error deleting user:", error);
});
const ProductsList = ({
productsList,
checkIsProductAddedToCart,
}) => (
<ul>
{productsList.map(product => (
<Product
addedToCart={checkIsProductAddedToCart(product.id)}
product={product}
/>
))}
</ul>
);
const mapStateToProps(state => ({
productsList: productListSelector(state),
checkIsProductAddedToCart: checkIsProductAddedToCartSelector(state),
}));
export default connect(mapStateToProps)(ProductsList);
const mapStateToProps((state, ownProps) => ({
isAddedToCart: isProductAddedToCartSelector(state, ownProps),
}));
export default connect(mapStateToProps)(ProductDetails);
import { createSelector } from 'reselect';
const cartSelector = state => state.cart;
const cartProductsSelector = createSelector(
cartSelector,
cart => cart.products,
);
// возвращает функцию, принимающую id, которую можно использовать при построении списков
const checkIsProductAddedToCartSelector = createSelector(
cartProductsSelector,
products => id => products.some(product => product.id === id),
);
const productIdSelector = (_, props) => props.product.id;
// возвращает булево значение, важно чтобы в компоненте было свойство product
const isProductAddedToCartSelector = createSelector(
cartProductsSelector,
productIdSelector,
(products, id) => products.some(product => product.id === id),
);