Προς το περιεχόμενο

problimataki se c


psarontoufekas

Προτεινόμενες αναρτήσεις

Δημοσ.

Sthn C, tis perissoteres fores, xrhsimopoioun thn

printf gia na emfanizoun sthn o8onh. Gia na thn

xrhsimopoihseis:

 

<pre><font class="small">code:</font><hr>

#include <stdio.h>

 

int main()

{

printf ("Hello, world!\n");

printf ("Let's print a character:%c", 'a');

printf ("Let's print two integers:%d and %d", 15, 25);

printf ("Let's print a float:%f", 5.5);

printf ("Let's print a string:%s", "Hello, world!");

return 0;

}

</pre><hr>

 

Gia to %f den eimai 100% sigouros.

Exei kai alla san ta d, c, f kai s.

Psa3e kai 8a ta breis.

 

Twra gia input, pali prepei na xrhsimopoihseis

to stdio.h. H synarthsh pou xreiazetai einai h

scanf...

 

<pre><font class="small">code:</font><hr>

#include <stdio.h>

 

int main()

{

int v;

scanf ("%d", &v);

return 0;

}

</pre><hr>

 

An 8ymamai kala ta %d, %f klp klp prepei na einai

idia me thn printf.

Prose3e to & pou exei h metablhth mprosta ths otan

thn xrhsimopoieis sthn scanf.

 

Elpizw na boh8hsoun.

Δημοσ.

euxaristo gia tin grigori apantisi.

auto pou i8ela na kanw ine naftiaksw menu sto opoio o xristis na

pataei ena ari8mo kai automata na metaferete sto menu pou epelekse. sou

stelnw ton kwdika na katalabis.to problima itan stin atoi opote ekana

cout kai de douleuei i iostream....

int menu(void)

 

 

{

int i;

char str;

 

printf("MAIN MENU\n");

printf("1. Add Members\n");

printf("2. Search Record\n");

printf("3. List Records\n");

printf("4. Modify Record\n");

printf("5. Delete Record\n");

printf("6. Quit\n");

 

do {

printf("Choose your selection:");

gets(str);

i = atoi(str); //metasximatizi tin alfari8mitiki

seira

printf("\n") //se akereo ari8mo

 

} while(i<1||i>6);

return i;

}

 

 

 

Αρχειοθετημένο

Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.

  • Δημιουργία νέου...