Armenian Knowledge Base  

Go Back   Armenian Knowledge Base > Technical sections > Languages, Compilers, Interpreters
Register

Reply
 
LinkBack Thread Tools
Old 17.10.2006, 10:54   #16
Младенец
 
Join Date: 05 2004
Location: usa
Age: 72
Posts: 35
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default

Quote:
Originally Posted by AvDav View Post
ti tam zakrivayushuyu skobku zabil, mojet iz-za etogo, xotya vryadli, opiat taki posmotri chto znachit oshibka kompiliatora C1004 v msdn-e
Reply With Quote
Old 17.10.2006, 11:31   #17
The splendid
 
AvDav's Avatar
 
Join Date: 07 2004
Location: Pure thoughts
Age: 36
Posts: 3,408
Downloads: 22
Uploads: 0
Reputation: 222 | 3
Default

vashe kogda stavish skobki, srazu stav i otkrivayushuyu i zakrivayushuyu mejdu nimi pishi, a to esli budet code poslojnee vashe zaputaeshsya chto gde zabil, a tak ne zabudesh
Reply With Quote
Old 17.10.2006, 21:34   #18
Лараян Арег
 
Lareg's Avatar
 
Join Date: 07 2006
Location: на семи холмах
Age: 37
Posts: 4,038
Downloads: 8
Uploads: 0
Reputation: 70 | 3
Default

Quote:
Originally Posted by AvDav View Post
vashe kogda stavish skobki, srazu stav i otkrivayushuyu i zakrivayushuyu mejdu nimi pishi, a to esli budet code poslojnee vashe zaputaeshsya chto gde zabil, a tak ne zabudesh
Лапусег, ну ты прям как наш школьный учитель информатики
Reply With Quote
Old 17.10.2006, 21:52   #19
The splendid
 
AvDav's Avatar
 
Join Date: 07 2004
Location: Pure thoughts
Age: 36
Posts: 3,408
Downloads: 22
Uploads: 0
Reputation: 222 | 3
Default

v otlichii ot nego ya "rabotayu" na volonterskoi osnove
Reply With Quote
Old 19.10.2006, 08:00   #20
Младенец
 
Join Date: 05 2004
Location: usa
Age: 72
Posts: 35
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default

kogda naprimer pishesh eto 13:45:36+04:22:54
to vixodit tak 18:8:30 vmesto 18:08:30
toje samoe 22:32:18+12:54:43 = 11:27:1
Reply With Quote
Old 19.10.2006, 09:12   #21
...overwined...
 
noone's Avatar
 
Join Date: 03 2003
Location: ...tortuga...
Posts: 3,429
Downloads: 3
Uploads: 0
Reputation: 158 | 3
Default

%02d...
Reply With Quote
Old 19.10.2006, 09:16   #22
Младенец
 
Join Date: 05 2004
Location: usa
Age: 72
Posts: 35
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default

cool ispasiba dabarish
a chto 02 oznochaet

eshe odna problema kogda viceslat nado tsifri 4:32:08-12:45:43
sec3=(sec1+60-sec2)%60;
min2=?
hour3=?

Last edited by centrino; 19.10.2006 at 10:41.
Reply With Quote
Old 20.10.2006, 12:50   #23
Младенец
 
Join Date: 05 2004
Location: usa
Age: 72
Posts: 35
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default

ya napisal tolko s oshibkoy ,v outpute tolko Error: Invalid operator: * it can either be + or -

gde oshibka,pomogite

Code:
#include<stdio.h>
int main(){

	int hour1,min1,sec1,hour2,min2,sec2,hour3,min3,sec3;
	int overall_second1,overall_second2;
	char f,math_operator;
    scanf("%d%c%d%c%d%c%d%c%d%c%d",&hour1,&f,&min1,&f,&sec1,&math_operator,&hour2,&f,&min2,&f,&sec2);


        if(math_operator == '*'){
        if(hour1>=24)
                     printf("Error: Invalid hour:   %d",hour1);
            else if(min1>=60)
                     printf("Error: Invalid minute: %d",min1);
			else if(min2>=60)
				     printf("Error: Invalid minute: %d",min2);
			else if(sec1>=60)
				     printf("Error: Invalid second: %d",sec1);
			else if(sec2>=60)
				     printf("Error: Invalid second  %d",sec2);



            return 0;
        }
        else{
            printf("Error: Invalid math_operator: * it can either be + or -");
            
            return 0;
        }
    


switch (math_operator){

case '+':

	overall_second1=(hour1*3600+min1*60+sec1)+(hour2*3600+min2*60+sec2);

	hour3=overall_second1/3600;
	min3=(overall_second1%3600)/60;
	sec3=(overall_second1%3600)%60;
	break;

case '-':

	overall_second2=(hour1*3600+min1*60+sec1)-(hour2*3600+min2*60+sec2);

	hour3=overall_second1/3600;
	min3=(overall_second1%3600)/60;
	sec3=(overall_second1%3600)%60;
    break;

}

printf("%02d%c%02d%c%02d",hour3,f,min3,f,sec3);

return 0;

}
Reply With Quote
Sponsored Links
Reply

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 04:14.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.