简单的程序 [英] Simple program

查看:59
本文介绍了简单的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我是新人//对不起我的英语:)


我必须写简单的程序我c ++。

但我不知道怎么样代码src - 程序应该知道它的名字

(unit1.exe所以名称是unit1或unit1.exe并且它是完整的路径

(带卷名 - c:\programs)。


我应该使用哪种c ++奖励?

(请不要重定向我''帮助'',因为我必须有一些开始

点!:)

-

Ground21 ____________ \\\ \\ b
ground21 @pocztaKROPKAfm

解决方案

Ground21写道:


你好。我是新人//对不起我的英语:)



你到目前为止做得很棒!


我必须编写简单的程序i c ++。

但我不知道如何编写src - 程序应该知道它的名字

(unit1.exe所以名称是QUOT; 1单元"或unit1.exe或并且它是完整的路径

(带卷名 - c:\programs)。


我应该使用哪种c ++的赞誉?

(请不要将我重定向到''帮助'',因为我必须有一些'开始

点'!:)



#include< iostream>

int main(int argc,char * argv [])

{

std: :cout<< 如果有的话,我的名字是[" << argv [0]<< "] \ n" ;;

返回0;

}


V

- -

请在通过电子邮件回复时删除资金''A'

我没有回复最热门的回复,请不要问


Victor Bazarov napisa3(a):


#include< iostream>

int main(int argc,char * argv [])

{

std :: cout<< 如果有的话,我的名字是[" << argv [0]<< "] \\\
" ;;

返回0;



非常感谢!

现在我正在尝试通过
$写入外部.txt文件的当前日期b $ b结构,但我有问题(写没有结构的日期还可以)...


我有类似的东西:


struct T_run

{

int hr;

int min;

int sec;

};


....


SYSTEMTIME st;

GetSystemTime(& st);

int秒,分钟,小时;

秒= st.wSecond;

分钟= st.wMinute;

小时= st.wHour;


T_run myinfo = {小时,分钟,秒};


....


outfile.write((char *)& myinfo,sizeof(T_run));


但是时间不是属性写的... :(


-

Ground21 ____________ \\

ground21 @ pocztaKROPKAfm


< blockquote> Ground21写道:


Now我正在尝试通过

结构写入外部.txt文件当前日期,但我遇到了问题(没有结构的写日期是

ok)...


我有类似的东西:


struct T_run

{

int hr;

int min;

int sec;

};


...


SYSTEMTIME st;

GetSystemTime(& st);



GetSystemTime不是标准C ++。但我想我明白你的意思了。

(仅供参考,这个小组应该只处理*标准* C ++,

如果可能,应该避免所有非标准的内容)


int秒,分钟,小时;

秒= st.wSecond;

分钟= st.wMinute;

小时= st.wHour;


T_run myinfo = {小时,分钟,秒};


...


outfile.write((char *)& myinfo,sizeof(T_run));


但是时间不是属性写的。 .. :(



我担心我们可能无法帮助你这么少

信息...


你期待什么输出?你得到什么?什么

*确切*是outfile?

BTW,你应该看一下常见问题
http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

如何po st代码无法正常工作。

遵循这些指导方针可以让我们更方便地帮助您。

干杯,

- -

IR


Hello. I''m new // sorry for my english :)

I have to write simple program i c++.
But I don''t know how to code src - program should know it''s name
(unit1.exe so the name is "unit1" or "unit1.exe" and it''s full path
(with volume name - c:\programs).

Which commends of c++ should I use?
(please do not redirect me to ''help'', because I must have some "start
point" ! :)
--
Ground21____________\\
ground21@pocztaKROPKAfm

解决方案

Ground21 wrote:

Hello. I''m new // sorry for my english :)

You''re doing great so far!

I have to write simple program i c++.
But I don''t know how to code src - program should know it''s name
(unit1.exe so the name is "unit1" or "unit1.exe" and it''s full path
(with volume name - c:\programs).

Which commends of c++ should I use?
(please do not redirect me to ''help'', because I must have some "start
point" ! :)

#include <iostream>
int main(int argc, char *argv[])
{
std::cout << "If available, my name is [" << argv[0] << "]\n";
return 0;
}

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


Victor Bazarov napisa3(a):

#include <iostream>
int main(int argc, char *argv[])
{
std::cout << "If available, my name is [" << argv[0] << "]\n";
return 0;

Thanks a lot!
Now I''m trying to write to an external .txt file current date via
structure but I have problems (writing date without structure was ok)...

I have something like that:

struct T_run
{
int hr;
int min;
int sec;
};

....

SYSTEMTIME st;
GetSystemTime(&st);
int second, minute, hour;
second = st.wSecond;
minute = st.wMinute;
hour = st.wHour;

T_run myinfo={hour,minute,second};

....

outfile.write((char*)&myinfo,sizeof(T_run));

but the time is not property written... :(

--
Ground21____________\\
ground21@pocztaKROPKAfm


Ground21 wrote:

Now I''m trying to write to an external .txt file current date via
structure but I have problems (writing date without structure was
ok)...

I have something like that:

struct T_run
{
int hr;
int min;
int sec;
};

...

SYSTEMTIME st;
GetSystemTime(&st);

GetSystemTime is not standard C++. But I guess I get your point.
(FYI this group is supposed to deal only with *standard* C++,
everything nonstandard should be avoided if possible)

int second, minute, hour;
second = st.wSecond;
minute = st.wMinute;
hour = st.wHour;

T_run myinfo={hour,minute,second};

...

outfile.write((char*)&myinfo,sizeof(T_run));

but the time is not property written... :(

I''m afraid we might not be able to help you with so little
information...

What output are you expecting? What are you obtaining? What
*exactly* is outfile?
BTW, you should look at the FAQ
http://www.parashift.com/c++-faq-lit...t.html#faq-5.8
for how to post code that doesn''t work correctly.
Following those guidelines would make it easier for us to help you.
Cheers,
--
IR


这篇关于简单的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆