Дата активности | Консольный раздел | Прогресс | ||
---|---|---|---|---|
2019-08-04 | book | 110. Функции | 100 % | |
2019-08-01 | book | 101. Математика | 115 % | |
2019-07-28 | book | 100. Массивы | 100 % | |
2019-07-26 | book | 011. Циклы | 100 % | |
2019-07-25 | book | 001. Числа | 100 % | |
2019-07-25 | book | 010. Условия | 100 % | |
2019-07-24 | book | 000. Строки | 100 % | |
Итого: | 102 % |
без проблем
using System;
class VideoSharp
{
static void Main()
{
switch (Console.ReadLine())
{
case "1":
Console.WriteLine("понедельник");
break;
case "2":
Console.WriteLine("вторник");
break;
case "3":
Console.WriteLine("среда");
break;
case "4":
Console.WriteLine("четверг");
break;
case "5":
Console.WriteLine("пятница");
break;
case "6":
Console.WriteLine("суббота");
break;
case "7":
Console.WriteLine("воскресенье");
break;
}
}
}
Привет. Можешь, пожалуйста скинуть код к задаче "Неделька"? Бот не хочет принимать задание из-за локализации, не знаю как исправить. Хоть у тебя посмотрю, как сделать...
Не понимает ваш бот русских букв, как ты не пытайся
В общем-то разобрался в чем проблема. Если на выходе в ответе есть лишние пробелы, то все задание неправильно. Следить нужно за этим всегда!
Так никто и не говорит, что нужно копировать код, если не разобрался:)
Просто дело-то не в коде, а в боте. Проверил несколько раз код - работает безукоризненно.
А перекодить на другом языке не могу - учу только один пока что. Вот отсюда и спасибо людям в комментариях
Я честно говоря приловчился к боту, просто поначалу было не привычно. Просто иногда из-за формализма приходится код перебивать. Коды я не копирую - иначе не интересно, если не решить уже тогда смотрю видеокурс или листаю комментарии. Скил потихоньку качается, решать задачи становится проще.
согласен, приходится копировать коды у людей в комментариях, ибо формально задача выполнена, что с ботом иногда случается, непонятно
#include <string>
#include <iostream>
using namespace std;
void trimstart(string stroka) {
int lenght = stroka.length();
int lenghtofspace = 0, lenghtofword = 0;
char s[] = { ' ', ' ' };
char buff[80];
for (int i = 1; i < lenght - 1; i++) {
if (stroka[i] == s[0] || stroka[i] == s[1]) {
lenghtofspace++;}
if (stroka[i] != s[0] && stroka[i] != s[1]) {
for (int j = i; j < lenght - 1; j++) {
lenghtofword++;}
break;}}
for (int i = 0; i < lenghtofword; i++) {
buff[i] = stroka[lenghtofspace + 1 + i];}
cout << "[";
for (int i = 0; i < lenghtofword; i++) {
cout << buff[i];}
cout << "]" << endl;}
void trimend(string stroka) {
int lenght = stroka.length();
int lenghtofspace = 0, lenghtofword = 0;
char s[] = { ' ', ' ' };
char buff[80];
for (int i = lenght - 2; i > 0; i--) {
if (stroka[i] == s[0] || stroka[i] == s[1]) {
lenghtofspace++;}
if (stroka[i] != s[0] && stroka[i] != s[1]) {
for (int j = i; j > 0; j--) {
lenghtofword++;}
break;}}
int j = 0;
for (int i = 1; i < lenghtofword+2; i++) {
buff[j] = stroka[i];
j++;}
cout << "[";
for (int i = 0; i < lenghtofword; i++) {
cout << buff[i];}
cout << "]" << endl;}
void trim(string stroka) {
int lenght = stroka.length();
int lenghtofspace = 0, lenghtofword = 0;
char s[] = { ' ', ' ' };
char buff[80];
int j = 0;
for (int i = 1; i < lenght - 1; i++) {
if (stroka[i] != s[0] && stroka[i] != s[1]) {
buff[j] = stroka[i];
j++;
lenghtofword++;}}
cout << "[";
for (int i = 0; i < lenghtofword; i++) {
cout << buff[i];}
cout << "]";}
int main() {
string text;
getline(cin, text);
trimstart(text);
trimend(text);
trim(text);}
#include <iostream>
#include <string>
#include <clocale>
using namespace std;
int main() {
string text, word;
char s[] = { ' ' };
char buff[80];
char result[256];
getline(cin, text);
getline(cin, word);
int lenght = text.length();
int wordsize = word.length();
int firstwordsize;
int j = 0;
for (int i = 0; i < lenght; i++) {
if (text[i] == s[0]) {
firstwordsize = i;
break;
}
}
for (int i = 0; i < lenght + wordsize; i++) {
result[i] = text[i];
if (text[i] == s[0]) {
for (int k = i + 1; k < wordsize + firstwordsize + 1; k++) {
result[k] = word[j];
j++;
}
break;
}
}
j = firstwordsize;
for (int i = wordsize + firstwordsize + 1; i < lenght + wordsize + 1; i++) {
result[i] = text[j];
j++;
}
for (int i = 0; i < lenght + wordsize + 1; i++) {
cout << result[i];
}
cout << endl;
}
Задача решена, не знаю, почему у вас пишет, что неверно
#include <iostream>
#include <string>
#include <clocale>
using namespace std;
int main() {
setlocale(LC_ALL, "ru");
string str;
int sizes[20];
char s[] = { " " };
char punkt[] = { '.', ',', ':', ';', '?', '!', '-' };
int letters = 0, max;
int j=0;
getline(cin, str);
int lenght = str.length();
for (int i = 0; i < lenght; i++) {
if (str[i] == s[0]) {
sizes[j] = letters;
j++;
letters = -1;
}
letters++;
for (int j = 0; j < 7; j++) {
if (str[i] == punkt[j]) {
letters--;
}
}
}
sizes[j] = letters;
for (int i = 0; i < 10; i++) {
if (sizes[i + 1] > sizes[i]) { max = sizes[i+1]; }
}
cout << max << endl;
}