【发布时间】:2022-01-24 10:29:29
【问题描述】:
好的,这就是我想要做的,我的总体目标是创建一个狙击机器人来狙击(使用的术语是)“OG 用户名”我目前在头文件中使用结构,我的原因这样做是为了减少代码重复,使程序运行更高效。我的总体目标是从网页中提取时间戳并计算运行任务的确切时间(以毫秒为单位)。
在头文件中有这样的内容:
struct TimeTilNameDrop
{
int days; //Integer for days
int hours; //Integer for hours
int minutes; //Integer for minutes
int seconds; //Integer for seconds
int miliseconds; //Integer for miliseconds
};
我试图以天、小时、分钟、秒为单位获取用户的输入,但我无法计算毫秒,我很感激这不准确,因为程序运行任务的时间需要几毫秒,我需要考虑到这一点。
#pragma warning(disable : 4996)
#include <iostream>
#include <ctime>
#include <time.h>
#include <NameDropData.h> //The headerfile containing the struct
using namespace std;
//Linker Decleration.
struct TimeTilNameDrop;
void Test(TimeTilNameDrop);
int TurboSnipe(Test)
{
cout << "Please enter the days til name drop";
cin >> days;
cout << "Please enter the hours til name drop";
cin >> hours;
cout << "Please enter the minutes til name drop";
cin >> minutes;
cout << "Please enter the seconds til name drop";
cin >> seconds;
}
我已经尝试查看其他教程,其中结构位于头文件中,我知道它可能会在其本地类中工作。但是,我喜欢效率的概念。任何帮助将不胜感激。
P.S 我是菜鸟,这是我的第一个项目。我知道它可能不起作用,或者我可能没有能力,但我认为这将是一个很好的项目。
哦,如果有人对任何好的 C++ 视频课程有任何建议,欢迎提出建议,我目前一直在做 “The Cherno's” C++ 系列,我刚刚了解了指针的工作原理。
欢迎提出建议 :)
【问题讨论】:
-
int TurboSnipe(Test)属于哪里?TimeTilNameDrop班级? -
根本不清楚您的实际问题/问题是什么。
-
turbo snipe 是一种方法,我试图创建一个存储在头文件中的结构实例,它也可以在 turbo snipe 方法中访问和写入,我不知道该怎么做, 然而。这是我的第一个问题,我确实尝试说清楚,如果不是,对不起。 TimeTilNameDrop 是头文件
标签: c++ performance struct time