diff --git a/c/l15/govno.c b/c/l15/govno.c new file mode 100644 index 0000000..a7fcabe --- /dev/null +++ b/c/l15/govno.c @@ -0,0 +1,12 @@ +#include + +int zzz(int i, int x, char *str) { + while(1) { + printf("%s\n", str); + i++; + if(i == x) { + return 0; + } + } + return 0; +} diff --git a/c/l15/main.c b/c/l15/main.c new file mode 100644 index 0000000..7971c64 --- /dev/null +++ b/c/l15/main.c @@ -0,0 +1,34 @@ +#include +#include +#include "govno.c" + +typedef struct { + int ot; + int doo; + char str[100]; +} Polz; + +Polz polz() { + Polz ret; + printf("От "); + scanf("%d", &ret.ot); + if(ret.ot < 0) { + ret.ot = 0; + } + printf("До "); + scanf("%d", &ret.doo); + if(ret.ot > ret.doo) { + printf("НЕКОРРЕКТНО\n"); + exit(1); + } + printf("Что "); + scanf("%99s", ret.str); + return ret; +} + +int main(void) { + Polz r = polz(); + zzz(r.ot, r.doo, r.str); + printf("\nГОЙДА ЕСТЬ\n"); + return 0; +} diff --git a/go/l17.go b/go/l17.go index f7e4647..3a9dca5 100644 --- a/go/l17.go +++ b/go/l17.go @@ -45,7 +45,7 @@ func WeatherReq() (string, float64, string, float64, float64, string) { client := &http.Client{ Timeout: 20 * time.Second, } - lin := "https://api.openweathermap.org/data/2.5/weather?q=" + city + "&units=metric&appid=" + api + lin := "https://api.openweathermap.org/data/2.5/weather?q=" + city + "&units=metric&appid=" + api + "&lang=ru" url := strings.ReplaceAll(lin, " ", "%20") req, err := http.NewRequest("GET", url, nil) if err != nil { @@ -69,9 +69,9 @@ func WeatherReq() (string, float64, string, float64, float64, string) { func Send(client mqtt.Client, topic string) { city, temp, main, speed, feel, description := WeatherReq() - payload := fmt.Sprintf("City: %s, Temperature: %.2f°C, Feel like %.2f°C\nWeather: %s, %s, Wind %.2fm/s", city, temp, feel, main, description, speed) + payload := fmt.Sprintf("Город: %s, Температура: %.2f°C, Ощущается %.2f°C\nПогода: %s, %s, Ветер %.2fm/s", city, temp, feel, main, description, speed) - token := client.Publish(topic, 1, false, payload) + token := client.Publish(topic, 2, false, payload) token.Wait() if err := token.Error(); err != nil { log.Fatalf("%v\n", token.Error()) diff --git a/go/output/l17 b/go/output/l17 index e8d1016..ed55178 100755 Binary files a/go/output/l17 and b/go/output/l17 differ