Jump to content


Check out our Community Blogs

nerio

Member Since 03 Sep 2010
Offline Last Active Jul 21 2011 01:01 PM
-----

Topics I've Started

delay function in C in number of seconds

21 July 2011 - 12:24 PM

Hi.

I study C. I need a function or something that will cause delay of given number of seconds, like delay(20) would wait 20 seconds before continuing.

How can I do that in C language?

Thank you.

string interrupted when there is a space

21 July 2011 - 12:20 PM

Hi.

I study C. I wrote the following program:

main()
{
char yourname[20];
printf("Enter your name: ");
scanf("%s", &yourname);
printf("The name you entered is %s",yourname);
getch();
}


But when I enter eg: 'Peter South', it only displays 'Peter'. I am used from Pascal, that the whole string is considered not to end when there is a space. How can I correct the program that it will display whole name user enters?

I have also try to correct it, here is the result:

main()
{
char yourname[40];
printf("Enter your name: ");
scanf("%s", &yourname);
int i;
printf("The name you entered is:\n");
for(i=0;i<40;i++){
printf("%s",yourname[i]);
}
getch();
}

But this doesn't work. Could you please help?

Thank you.

Why there is a common category for C and C++?

20 July 2011 - 11:28 PM

I think it is weird. Those two languages are actually different. I was recommended to study C first and then start with C++. But when I post something in C/C++ ccategory, how can I know if the guys will talk about which one of them?

I like this forum, but I think this is kind of weird.

full size of the window, full screen mode

20 July 2011 - 01:53 PM

Hi.

I use Microsoft Windows 7, 64 bit. My compiler is Dev.

When I write a program, that only prints results in text mode, and compile it and run it, I cannot increase the size of the window, so that if will be "full screen". Not even Alt+enter works.

How can I achieve that?

Thank you.

how to change the background color in text mode in C?

14 July 2011 - 10:05 AM

Hi. How to change the background color in text mode in C?

Things I have tried:

textbackgroundcolor(BLUE);

I know how to change color of text. But I don't have a clue about the background.

I also do know how to do it partially, just bellow the text. This is here: Win32 Console Applications 4

I would like to do it everywhere, not just bellow the text.

Another idea could be the "system("cls")" command, but it always clears it to black color.

Also, if it is necessary I am using Windows 64 bits, Dev compiler.

Thank you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download