влаласт
05.10.2021 01:57

Разработайте 2D игру. Используйте в игре фон и персонажи.

Доработайте в игре возможность управления персонажами с клавиатуры.

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
katyavoloshina1
29.12.2020 08:34

#include <iostream>

#include <cmath>

#include <vector>

using namespace std;

int main() {

vector<float> coordinates;

string a;

getline(cin, a);

string buffer;

for(int i = 0; i<a.length(); ++i) {

 if(a[i]!=' ') {

  buffer+=a[i];

 } if(a[i]==' '||i==a.length()-1) {

  if(buffer[buffer.length()-1]=='.') {

   buffer+="0";

  }  

  float num = stof(buffer);

  coordinates.push_back(num);

  buffer = "";

 }

}

if(coordinates.size()!=4) {

 cout << "wrong data. example: 1.1 2.2 3.3 4.4";

}

float result;

int temp1, temp2, temp3, temp4;

temp1 = coordinates[0]-coordinates[2];

temp2 = coordinates[1]-coordinates[3];

temp1 = temp1 * temp1;

temp2 = temp2 * temp2;

temp3 = temp1 + temp2;

result = sqrt(temp3);

cout << result;

}

0,0(0 оценок)
Ответ:
Wakawak
30.11.2020 05:44

#include <iostream>

#include <string>

#include <cctype>

using namespace std;

signed main() {

 

string line, buff = "";

bool isPalindrome = true;

getline(cin, line);

for (int i = 0; i < line.size(); i++) {

 if (isalnum(line[i]))

  buff += line[i];

}

for (int i = 0; i < buff.size() / 2; ++i)

{

 if (buff[i] != buff[buff.size() - i - 1])

 {

  isPalindrome = false;

  break;

 }

}

if (isPalindrome)

 cout << "TRUE";

else

 cout << "FALSE";

return 0;

}

0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота