Armenian Knowledge Base  

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

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

privet
ya tut voprosi budu zadavat ,mojno? vcera nachal


kak mojno napisat chasi v C?

12:45:07

Code:
int main(){

	int a,b,c;
scanf("%d%d%d",&a,&b,&c);

printf("%d %d %d",a,b,c);
vidaet takuyu fignyu

Code:
12-858993460-858993460
Reply With Quote
Old 15.10.2006, 11:03   #2
Младенец
 
Join Date: 05 2004
Location: usa
Age: 72
Posts: 35
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default

xe tak polchaetsa,no eto navernoe ne samoe umnoe reshenie

Code:
int main(){

	int a,b,c;
	char f;
scanf("%d%c%d%c%d",&a,&f,&b,&f,&c);

printf("%d%c%d%c%d",a,f,b,f,c);
return 0;
Reply With Quote
Old 15.10.2006, 11:38   #3
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

predlagayu prosmotret' knijenciu po C, jelatelno Kernigain & Ritchi, ostalnoe faymelu harca
Reply With Quote
Old 15.10.2006, 11:49   #4
Младенец
 
Join Date: 05 2004
Location: usa
Age: 72
Posts: 35
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default

posmotrel ,eto kniga dlya experienced ones
Reply With Quote
Old 15.10.2006, 11:55   #5
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

ya bi ne skazal...
kak na schet Podbelski & Fomin?
Reply With Quote
Old 15.10.2006, 12:06   #6
Младенец
 
Join Date: 05 2004
Location: usa
Age: 72
Posts: 35
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default

neznayu ne sliashal,ya citayu deitela

kak mojno sdelat eto?
Quote:
input 13:45:36+04:22:54
output 18:08:30
Reply With Quote
Old 15.10.2006, 13:14   #7
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

deitel ne c a c++, i to ploxoi
beri input kak stroku (char str[15]; scanf("%s", &str) dalee proidis po stroke, vozmi snachenia min/sec/hour dlia oboix znacheniy, perevedi v int cherez atoi(); dalee dlia outputa budet sec = (sec1+sec2)%60; min = (min1+min2)%60 + (sec1+sec2)/60; hour = (hour1+hour2)%24 + (min1+min2)/60;
__________________
The main achievements in applied research are due to fundamental science.
Reply With Quote
Old 16.10.2006, 07:04   #8
Грустно...
 
Agregat's Avatar
 
Join Date: 08 2002
Location: Там, где всегда идут дожди
Age: 35
Posts: 21,717
Downloads: 2
Uploads: 0
Reputation: 250 | 7
Default

уже очень плохо
Code:
char str[15]; scanf("%s", &str)
1. не надо брать адрес
2. вулнерабилити... что если я введу 300 символов?
Reply With Quote
Old 16.10.2006, 07:21   #9
Младенец
 
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
deitel ne c a c++, i to ploxoi
beri input kak stroku (char str[15]; scanf("%s", &str) dalee proidis po stroke, vozmi snachenia min/sec/hour dlia oboix znacheniy, perevedi v int cherez atoi(); dalee dlia outputa budet sec = (sec1+sec2)%60; min = (min1+min2)%60 + (sec1+sec2)/60; hour = (hour1+hour2)%24 + (min1+min2)/60;
kak string brat ne polojeno ,poka
kak delayut debug,chto eto oznochaet? u menya inogda okno vixodit s debugom kogda execute delayu

vobsheto vot eto nado
Quote:
Sample Run 1:
13:45:36+04:22:54
18:08:30
Sample Run 2:
22:32:18+12:54:43
11:27:01
Sample Run 3:
17:43:22-4:12:56
13:30:26
Sample Run 4:
4:32:08-12:45:43
15:46:25
Sample Run 5:
12:23:56-156:34:32
23:49:24
Sample Run 6:
14:32:45+176:43:18
23:16:03
Sample Run 7:
28:34:32+03:32:14
Error: Invalid hour: 28
Sample Run 8:
12:98:13-3:32:14
Error: Invalid minute: 98
Sample Run 9:
22:01:76+12:32:44
Error: Invalid second: 76
Sample Run 10:
12:43:22*4:22:43
Error: Invalid operator: * it can either be + or -
Sample Run 11:
12:54:32-43:98:23
Error: Invalid minute: 98
Sample Run 12:
12:43:56+13:43:99
Error: Invalid second: 99
Reply With Quote
Old 16.10.2006, 08:13   #10
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

Quote:
Originally Posted by Agregat View Post
уже очень плохо
Code:
char str[15]; scanf("%s", &str)
1. не надо брать адрес
2. вулнерабилити... что если я введу 300 символов?
1. da i pravda address ne nujen, po privichke napisal.
2. pust vidast soobshenie tipa ubeditelnaya prosba ne vvodit bolshe stoka to simvolov tada pust getchar()om schitivaet do konca.

2 centrino> ya uje skazal kak nado, pisat kod mne neoxota sam pishi
Reply With Quote
Old 17.10.2006, 10:10   #11
Младенец
 
Join Date: 05 2004
Location: usa
Age: 72
Posts: 35
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default

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

	int a,b,c;
	char f;
scanf("%d%c%d%c%d",&a,&f,&b,&f,&c);

printf("%d%c%d%c%d",a,f,b,f,c);
return 0;
takoy error daet v chem problema?

Code:
C:\Documents and Settings\centrino\Desktop\123\Cpp1.cpp(10) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Reply With Quote
Old 17.10.2006, 10:29   #12
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

1. zakroi, snova otkroi proekt
2. esli ne viidet sozdai novi vpixni svoi source tuda
3. esli ne viidet, posmotri v msdn.com chto znachit oshibka C1004.
4. esli opiat net resultata, perestav vc++ s service packom (esli 6-oi).
5. esli opiat ne viidet to eto zloi rok
Reply With Quote
Old 17.10.2006, 10:47   #13
Младенец
 
Join Date: 05 2004
Location: usa
Age: 72
Posts: 35
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default

1,2 sdelal ne polucilos
neujeli podrugomu nikak nelsya napisat etu stroku?
Reply With Quote
Old 17.10.2006, 10:50   #14
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

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, 10:53   #15
...overwined...
 
noone's Avatar
 
Join Date: 03 2003
Location: ...tortuga...
Posts: 3,429
Downloads: 3
Uploads: 0
Reputation: 158 | 3
Default

ну или скобку поставь в конце...
Reply With Quote
Sponsored Links
Reply

Thread Tools


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

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


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