Inanzitutto voglio salutare tutti gli users del forum.Arrivo al dunque.
Sono mesi che provo a creare un programmino all'apparenza stupido, ma per me ,per l'appunto irrisolvibile.
Ora provo a fare affidamento a questo forum contando sull'aiuto di qualche anima buona![]()
Svolgimento:
Definisco i seguenti tipi di dato,
------------------------------------------------------------
1. ALFABETO che puo assumere i valori da A fino a Z
2. OCCORRENZE che memorizza il numero di occorrenze di ogni lettera dell'alfabeto e a cui si accede utilizzando i valori di ALFABETO
3. BOOL che puo assumere valori FALSO,VERO
------------------------------------------------------------
Adesso implemento le seguenti funzioni C
1. void input(*char) che gestisce l'input da tastiera permettendo l'inserimento di nomi di file ed effettuando il controllo sulla correttezza del nome inserito.Accetta l'inserimento della stringa vuota
2.BOOL termina(*char)che controlla se e' stata introdotta la stringa vuota
3.void output(char*,OCCORRENZE)che esegue l'output su file(ecco qui ho scoperto che devo utilizzare lo stesso nome file in input,variando il prefisso in -OUT),normalizzando a 50 tutti i valori da stampare(valore_normalizzato=risultato*50/max (risultati) ),
e scrivendo quanto ottenuto in modo che abbia il seguente aspetto
A) ]]]]]]]-nA
B) ]]]]]]]]]]]]-nB
[....]
Z) ]]]-nz
con un numero di parentesi quadre pari al numero normalizzato di occorrenze di ogni lettera e con n|=numero di occorrenze della lettera|
1. void conta(char*,OCCORRENZE*)che accede al file di testo il cui nome e' stato introdotto da standard input e ne conta(memorizzandone il valore nella variabileopportuna)le occorrenze di ogni lettera (non case sensitive)di cui e' composto(il file e':Lemon
See through in the sunlight
She wore lemon
But never in the daylight
She's gonna make you cry
She's gonna make you whisper and moan
And when you're dry
She draws her water from the stone
And I feel
Like I'm slowly, slowly, slowly slipping under
And I feel
Like I'm holding onto nothing
She wore lemon
To colour in the cold grey night
She had heaven
And she held on so tight
A man makes a picture
A moving picture
Through the light projected
He can see himself up close
A man captures colour
A man likes to stare
He turns his money into light to look for her
And I feel
Like I'm drifting, drifting, drifting from the shore
And I feel
Like I'm swimming out to her
Midnight is where the day begins
Midnight is where the day begins
Midnight is where the day begins
Lemon
See through in the sunlight
A man builds a city
With banks and cathedrals
A man melts the sand so he can
See the world outside You're gonna meet her there
A man makes a car She's your destination
And builds roads to run them on You gotta get to her
A man dreams of leaving She's imagination
But he always stays behind
And these are the days
When our work has come assunder
And these are the days
When we look for something other
Midnight is where the day begins
Midnight is where the day begins
Midnight is where the day begins
Midnight is where the day begins
Midnight is where the day begins
Midnight is where the day begins
Midnight is where the day begins
Midnight is where the day begins
A man makes a picture
A moving picture
Through the light projected
He can see himself up close You're gonna meet her there
A man captures colour She's your destination
A man likes to stare There's no sleeping there
He turns his money into light She's imagination
To look for her Lemon
She is the dreamer
She's imagination She had heaven
Through the light projected
He can see himself up close She wore lemon)
Il main va costruito che termina con l'inserimento della stringa vuota
.
Grazie e spero di avere una risposta al piu presto.![]()

Rispondi quotando
