Questo sito utilizza cookies
solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi
l'informativa sui cookies
.
Accesso in corso...
Username:
Password:
oppure
Username o password invalidi
Forum
Sorgenti
C
C++
Managed C++
Visual Basic .NET
Visual Basic
Visual C++
Java
C#
Perl
Qbasic
Delphi
Python
Prolog
Lua
Scheme
Cobol
LabVIEW
Ruby
ASP
PHP/MySQL
x86 Assembly
MIPS Assembly
Pascal
Fortran
Bash
Gml
Javascript
Programmi
Animazioni
Desktop
Esempi
Giochi
Grafica e Fotografia
Insegnamento e hobby
Internet
Lavoro e finanza
Matematica e fisica
Moduli e librerie
Musica
Networking
Scripts
Sicurezza
System Tweak
Utility
Web authoring
Guide
Visual Basic .NET
Pascal
HTML
SDL
Typescript
VBScript
Batch scripting
GWBasic
Licenze Software
Recensioni
Manuali
Software
Tutorials
Linguaggi
ASP
C
C#
C++
Delphi
Java
Pascal
Perl
PHP
Prolog
Python
Ruby
Ruby On Rails
Scheme
Visual Basic
Google
Hardware
Informatica
Internet
iPhone
Masterizzare
CD
DVD
Files Immagine
Mp3 e Audio
Sicurezza e OS
Sistemi operativi
Linux
Windows
Video Digitale
Lezioni
Programmazione
Ruby
iOS
Tecnologie
Multi Touch
Project Zone
Che cos'è?
Progetti più attivi
Editor mappe
Analisi testi
Parole
FILDER
2048
2D Mappy
RTDownloadCounter
SSBackUp
Estrazione
Codificatore
pSIMPLETRON
ErrorReporter.NET
Web Escape
Napoleon
Mini Cad
Tutti i progetti
Utility
News nel tuo sito
Blog
Compilatori
Masterizzare
Siti amici
Pubblica un sorgente
Programmare
Come imparare a programmare
Come diventare un buon programmatore
Community
Chi Siamo?
Membri
Dev Team
Join Us
Libreria
Premio Stallman
I Top 10
Medagliere
Mascotte
Foto raduni
Assumici
Scrivici
supportaci
Forum
-
C/C++
- programma che simula un flip flop jk
matteog
(Normal User)
Pro
Messaggi:
149
Iscritto:
10/04/2009
Postato alle
21:22
Sabato, 10/10/2009
Codice sorgente - presumibilmente C++
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
#include <conio.h>/* utilizzando le API di Windows */
#include <iostream>
using
namespace
std
;
bool
j
=
false
,k
=
false
,q
=
false
,qn
=
false
;
void
jkinput
(
bool
j,
bool
k
)
;
int
main
(
)
{
while
(
";;"
)
{
jkinput
(
j,k
)
;
}
system
(
"pause"
)
;
return
0
;
}
void
jkinput
(
bool
j,
bool
k
)
{
char
tasto
=
0
;
if
(
_kbhit
(
)
)
{
tasto
=
_getch
(
)
;
}
if
(
tasto
==
'J'
)
{
j
=
true
;
}
else
if
(
tasto
==
'j'
)
{
j
=
false
;
}
else
if
(
tasto
==
'K'
)
{
k
=
true
;
}
else
if
(
tasto
==
'k'
)
{
k
=
false
;
}
else
{
tasto
=
-
1
;
}
if
(
j
==
false
&&
k
==
false
)
{
system
(
"cls"
)
;
cout
<<
" J K Q Q+1"
<<
endl
;
cout
<<
""
<<
j
<<
" "
<<
k
<<
" Q"
<<
" Q+1"
<<
endl
;
cout
<<
"conclusione:"
<<
endl
;
cout
<<
"con J e K a 0 le uscite non cambiano"
<<
endl
;
}
else
if
(
j
==
true
&&
k
==
false
)
{
system
(
"cls"
)
;
cout
<<
" J K Q Q+1"
<<
endl
;
cout
<<
""
<<
j
<<
" "
<<
k
<<
" 0"
<<
" 1"
<<
endl
;
cout
<<
"conclusione:"
<<
endl
;
cout
<<
"con J a 1 e K a 0 le uscite hanno come uscita reset"
<<
endl
;
}
else
if
(
j
==
false
&&
k
==
true
)
{
system
(
"cls"
)
;
cout
<<
" J K Q Q+1"
<<
endl
;
cout
<<
""
<<
j
<<
" "
<<
k
<<
" 1"
<<
" 0"
<<
endl
;
cout
<<
"conclusione:"
<<
endl
;
cout
<<
"con J a 0 e K a 1 le uscite hanno come uscita set"
<<
endl
;
}
else
if
(
j
==
true
&&
k
==
true
)
{
system
(
"cls"
)
;
cout
<<
" J K Q Q+1"
<<
endl
;
cout
<<
""
<<
j
<<
" "
<<
k
<<
" Q"
<<
" Q+1"
<<
endl
;
cout
<<
"conclusione:"
<<
endl
;
cout
<<
"con J e K a 1 le uscite vengono complementate"
<<
endl
;
}
}
quando premouno dei tasti scelti ovvero K,k,J,j non cambia la stampa mi sapete aiutare??? il programma è possibile migliorarlo?
theprogrammer
(Normal User)
Guru^2
Messaggi:
2509
Iscritto:
28/01/2009
Postato alle
8:56
Domenica, 11/10/2009
E invece cambia, ma velocemente cosi' che forse tu non te ne accorgi.
P.S. La riga
while(";;")
non ha senso. Si scrive
while(1)
se si vuole usare la while, oppure
for(;
se si vuole usare la for per un ciclo infinito.
Ultima modifica effettuata da
theprogrammer
il 11/10/2009 alle 11:35
matteog
(Normal User)
Pro
Messaggi:
149
Iscritto:
10/04/2009
Postato alle
14:50
Domenica, 11/10/2009
0k grazie ma per far si di vedere la stampa che cambia come possso fare?qualche idea?
theprogrammer
(Normal User)
Guru^2
Messaggi:
2509
Iscritto:
28/01/2009
Postato alle
15:18
Domenica, 11/10/2009
Beh, mi sembra scontato ... attendi un tasto oppure imposti una pausa ...
matteog
(Normal User)
Pro
Messaggi:
149
Iscritto:
10/04/2009
Postato alle
15:26
Domenica, 11/10/2009
ok grazie