PLZ Don't make mistake about what i'm writing
& if u dont understand dont answer plz.
I need just a digital clock in C++ with gotoxy &print"****" &...
i want to find the difference between this one & the others completely
no different if any one just wrote with gotoxy &...

#include<stdio.h>   
#include<conio.h>    
#include<iostream>
#include <Windows.h>
#include<time.h>     
using namespace std;
int main()
{
int sec,min,hour;
for(hour=0;hour<=24;hour++)
{
for(min=0;min<=60;min++)
{
for(sec=0;sec<=60;sec++)
{
 gotoxy(12,50);

cprintf("Timer Simulation By Shariq Khan,Press Any Key To Exit");

gotoxy(30,16);
cprintf("****************");
gotoxy(35,18);
cprintf("H:M:S");
gotoxy(35,20);
cprintf("%d:%d:%d",hour,min,sec);
gotoxy(30,22);
cprintf("****************");
delay(1000);
if(kbhit(;))
exit(1)
}
}
}
getch();
}

this is sth like the one i want to write but it has some errors
I want to write this in Visual C++
not in turbo

Recommended Answers

All 9 Replies

I have a binary clock in my C# code snippet section, with this code.

public static int ReadBit(int number, int BitPosition)
{
   int i = number & (1 << BitPosition); //i=2^^Bitposition
   return (i > 0 ? 1 : 0);
}

This is C#, but I guess it reads like C++.
Used it to read every bit out of a number.

no no
that as u say is for C#
Just solve The errors
i don't know why it erroring for gotoxy

Line 10: for(hour=0;hour<=24;hour++) That 25 hours, use for(hour=0;hour<24;hour++) Same for the other for loops.
And what is happening when you do your gotoxy?
I know that you are printing 86400=24x60x60 times line 18 for instance. Is that your intention?

yes yes U are right
so

for(hour=0;hour<24;hour++)
{
for(min=0;min<60;min++)
{
for(sec=0;sec<60;sec++)
{

this is my mistake
And the last one no(about the gotoxy)
I Just choose a Place to show the "" to make the numbers
thats my main Problem
I know that i should placing"
" for each number but there is an error
it errors for gotoxy i dont know why

Could you tell me what the error message is you are getting?

it says that gotoxy is undefined but #include <Windows.h> is in my writing

In the dark middle ages of the previous century I programmed for a short while in Turbo C++ and as far as I can remember gotoxy is for a textwindow(conio.h)(console input output) so leave #include <Windows.h> out.

But I think I wil need
anyway
I wroted conio.h too but...
also I'm in Visual C++
I'm really confused about these errors.

You can't use old Turbo C++ syntax in a modern C++ compiler system like Visual C++.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.