RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-322984

Vova Makarovych's questions

Martin Hope
Vova Makarovych
Asked: 2024-12-19 05:24:29 +0000 UTC

使用 C 字符串的函数无法正常工作

  • 6

任务 - 该函数采用字符串作为输入。因此,它应该创建并返回一个新字符串,其中包含该字符串中仅出现一次的所有字符。

我的代码

сhar* findOneCString(const char* str)
{
   const size_t size = strlen(str);
   char* strNew = new char[size + 1];
   int num = 0;

   for (size_t index = 0; index < size; ++index) 
   {
      for (size_t j = size; j > index; --j)
      {
         if (str[index] == str[j])
         { 
          
         }
         else 
         {
            strNew[num] = str[index];
            ++num;
        }
      }
   }
 strNew[num] = '\0';
 return strNew;
}

我收到错误,但我不明白为什么(

  1. 内存泄漏
  2. 这些值被写入新数组几次。

我知道对于大多数人来说这个任务很容易..但我不明白我哪里做错了

c++
  • 2 个回答
  • 87 Views
Martin Hope
Vova Makarovych
Asked: 2020-11-18 03:43:02 +0000 UTC

如何在Lua中传递文件路径?

  • 1

我需要从函数中的文件中读取。文件在与代码相同的文件夹中。我这样通过:local inputFileName = [[ts.txt]] 但它会引发错误:

ts.txt:没有这样的文件或目录)

lua
  • 2 个回答
  • 10 Views
Martin Hope
Vova Makarovych
Asked: 2020-11-17 04:58:14 +0000 UTC

如何在二维数组中获取索引

  • 2

我有一个二维数组

 local array = {{1, "t"}, {23, "p"}}

而且我在任何地方都找不到如何访问,例如分别访问 1 和 t 。不要扔拖鞋。请张贴一个链接到这里写的地方。我自己没有找到。或者举个例子。比如我在一个循环中去,我怎么能在里面分别访问它们呢?

lua
  • 1 个回答
  • 10 Views
Martin Hope
Vova Makarovych
Asked: 2020-10-25 01:02:41 +0000 UTC

需要将字符串拆分为单词,删除标点符号[关闭]

  • -1
关闭。这个问题需要澄清或补充细节。目前不接受回复。

想改进这个问题?通过编辑此帖子添加更多详细信息并澄清问题。

2年前关闭。

改进问题

我写了,但是我的函数在记录向量中没有做一个单词,而是一个字母。
如何在没有标准的帮助下完成任务?
需要你的帮助。 如果是标点符号,则
函数IsPunctuation返回。 代码示例:bool

std::vector<char> Split(char* str) 
{
    std::vector<char> ch(strlen(str));

    for (size_t index = 0; str[index] != '\0'; ++index)
    {
        if (IsPunctuation(str[index]))
        {
            ch.push_back(str[index]);
        }
    }
    return ch;
}



UPD:

     bool IsPunctuation(char ch)
    {
        const char* punctuation = "~`!@#$%^&*()-_+=,./?;:' ";
        for (size_t p = 0; punctuation[p] != '\0'; ++p)
            if (ch == punctuation[p])
                return true;
        return false;
    }

UPD1:
-I
-like
-
-this
-
-it
-
c++
  • 1 个回答
  • 10 Views
Martin Hope
Vova Makarovych
Asked: 2020-08-11 14:58:46 +0000 UTC

我需要适应 20 x 20 编号的单元格

  • 0

我需要放置 20 x 20 编号的单元格。像这样的东西 1 1 2 3 4 5 2 1 2 3 4 5 3 1 2 3 4 5 4 1 2 3 4 5

等等。您如何建议在 Angular 中执行此操作。不做简单的枚举。PS并且那里的单元格应该靠近数字。我认为增加或减少数量。

css3
  • 1 个回答
  • 10 Views
Martin Hope
Vova Makarovych
Asked: 2020-06-10 14:51:30 +0000 UTC

std::snprintf 函数无法正常工作

  • 0

我需要它被输出Score: 0:0,它的输出是这样Score: 0的。我这样做:

std::snprintf(textBuffer, sizeof(textBuffer), "Score: %d",  currentPlayerScore, ": %d", currentEnemyScore);

并尝试这样:

std::snprintf(textBuffer, sizeof(textBuffer), "Score: %d", ": %f", currentPlayerStrikerScore, currentEnemyStrikerScore);

但是这里完全推断出一些废话。请告诉我如何正确处理。

c++
  • 1 个回答
  • 10 Views
Martin Hope
Vova Makarovych
Asked: 2020-06-03 19:27:13 +0000 UTC

给出关于抽象类的错误,我不明白我有什么问题

  • -1

错误:严重代码描述项目文件行抑制状态错误(活动)E0322 抽象类类型“AirHockeyGame”的对象不允许:AirHockey

我的代码:

 #include "AirHockeyGame.h"

 int main(int argc, char** argv)
 {
    AirHockeyGame airHockeyGame;
    airHockeyGame.LaunchGame();
    return 0;
 }  

曲棍球游戏代码

#include "PlayGameState.h"

class AirHockeyGame : public PlayGameStateListener
{
  public:
   AirHockeyGame();
   ~AirHockeyGame();
}

我做错了什么?

UPD

   class PlayGameStateListener
   {
        public:
          virtual ~PlayGameStateListener() {}

          virtual void OnLevelLose() = 0;
          virtual void OnLevelComplete() = 0;
   };
c++
  • 1 个回答
  • 10 Views
Martin Hope
Vova Makarovych
Asked: 2020-04-07 07:31:04 +0000 UTC

如何摆脱`system.data.sqlserverce.4.0无法加载`错误

  • 0

我有个问题。我一直在为错误苦苦挣扎半天,但它仍然存在 错误代码

我已经看了一遍,但我看不出有什么问题。远足,它在这条线上尖叫:

  public DataBaseContext() : base("DbConnection")

在这堂课中:

 public class DataBaseContext : DbContext
{
    public DataBaseContext() : base("DbConnection")
    { }

    public DbSet<UserInfo> UserInfo { get; set; }
}

应用配置:

<connectionStrings>
  <add name="DbConnection" connectionString="Data Source= .\SQLEXPRESS;Initial Catalog=SocialNetwork;Integrated Security=True;Persist Security Info = True;" providerName="System.Data.SqlClient" />
</connectionStrings>

请帮我看看错误...

sql-server
  • 1 个回答
  • 10 Views
Martin Hope
Vova Makarovych
Asked: 2020-02-07 00:54:39 +0000 UTC

序列化和反序列化不起作用

  • -2

我需要将矩阵写入文件并从中读取。我编写了代码,但它给了我一个无法写入文件的错误。需要你的帮助

        BinaryFormatter formatter = new BinaryFormatter();

        using (FileStream fs = new FileStream("matrix.dat", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None))
        {
            formatter.Serialize(fs, matplus);

            Console.WriteLine("Объект сериализован");
        }

        //десериализация
        using (FileStream fs = new FileStream("matrix.dat", FileMode.OpenOrCreate))
        {
            Matrix deserilizeMatrix = (Matrix)formatter.Deserialize(fs);
            Console.WriteLine("Ета матрица?");
        }
c#
  • 1 个回答
  • 10 Views
Martin Hope
Vova Makarovych
Asked: 2020-01-11 16:40:23 +0000 UTC

MySubstring 自己的函数

  • 0

我决定编写自己的函数 MySubstring。但是我不确定我是否做对了所有事情 + 在 main 它给出了一个我不能那样写的错误

string mySubstring = MySubstring(str1, 3, 3);

编码:

string MySubstring(string str, int startIndex, int length)
{
    string temp = System.String.Empty;
    for (int index = 0; index < str.Length; ++index)
    {
       if (str[index] == startIndex)
       {
          for (int j = 0; j < length; ++j)
          {
             temp += str[index];
          }
       }
    }
    return temp;
}
static void Main(string[] args)
{
   string str1 = "I like it like that";
   string mySubstring = MySubstring(str1, 3, 3);
   System.Console.WriteLine(mySubstring);
}
c#
  • 1 个回答
  • 10 Views
Martin Hope
Vova Makarovych
Asked: 2020-01-10 18:48:14 +0000 UTC

将三个字符串连接为一个的函数

  • 0

我编写了一个将三个字符串连接为一个的函数,但我只是在学习 C#,所以它没有成功。请告诉我为什么我的代码不起作用:

namespace ConsoleApplicationTest1
{
   class Program
   {
      string Сoncatenation(string str1, string str2, string str3)
      {
         str1 += str2;
         str1 += str3;

         return str1;
     }
     static void Main(string[] args)
     {
        string st1 = "Vova Na";
        string st2 = "ik bb";
        string st3 = "gdsadsds";

        string correct = Сoncatenation(st1, st2, st3);

        System.Console.WriteLine(correct);
    }
   }
}
c#
  • 3 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5