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

HELP on C


TASOS60

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

Δημοσ.

kano programatismo stin c kai polles fores kata thn

ektelesi enos programmatos me emfanizei

h mnimi den mporei na einai "write"

h "read"

ftaine oi entoles h kati allo; <img src="http://www.insomnia.gr/ubbthreads/images/graemlins/confused.gif" alt="" />

Δημοσ.

Το πιο πιθανό είναι ότι έχεις βγει εκτός ορίων κάποιου πίνακα που χρησιμοποιείς και διαβάζεις/γράφεις κάποια θέση στην οποία δεν έχει access το πρόγραμμα σου.

Δημοσ.

to programma einai ayto anoigo kapoio arxeio kai topotheto kapia dedomena sto telos thelo na emfaniso to teleyteo gramma toy epithetou

#include<stdio.h>

main()

{

int afm,counter=0;

char name[12],epith[25],artau[7],ch;

FILE*fpa;

/*diniourgia arxeiou*/

if((fpa=fopen("myfile.txt","w"))==NULL)

{

printf("can't creat the file try again\n");

exit(1);

}

/*diabasma timon*/

 

printf("dose to onoma\n");

gets(name);

 

printf("dose to epitheto\n");

scanf("%s",epith);

 

printf("dose to AFM\n");

scanf("%d",&afm);

 

printf("dose ton arithmo taytotitas\n");

scanf("%s",artau);

/*topothetisi timon sto arxeio*/

fprintf(fpa,"%s %s %d %s",name,epith,afm,artau);

fclose(fpa);

/*anoigei ksana to arxeio*/

if((fpa=fopen("myfile.txt","r"))==NULL)

{

printf("can't opent the file try again\n");

exit(1);

}

/*grafpimo ton zhtoumenon dedomenon*/

fscanf(fpca"%1s %s %d %s",name,epith,&afm,artau);

printf("to proto grama toy onomatos einai:\n %s\n",name);

printf("to teleyteo tou epithetou einai:\n %s\n",epith[1]);

}

prospotho esto na emfaniso to epith[1] kai me me bgainei h mnimi den mporei na einai read eno plikrologo ena epitheto esto tasos

min didenete shmasia se perites deiloseis poy exo to programa zitoyse kai alla poy den htan aparetita na ta anafero

xreisimopoio to Microsoft Visual Studio(Microsoft Visual C++6.0)

 

Δημοσ.

xoris elegxous ktl apla dior8osa oti ekanes (episis o kodikas etsi opos ton dinis den ginete compile exi la8i!)

 

 

#include<stdio.h>

 

#include <stdlib.h>

 

 

void main()

{

int afm,counter=0;

char name[12],epith[25],artau[7],ch;

FILE*fpa;

/*diniourgia arxeiou*/

if((fpa=fopen("myfile.txt","w"))==NULL)

{

printf("can't creat the file try again\n");

exit(1);

}

/*diabasma timon*/

 

printf("dose to onoma\n");

gets(name);

 

printf("dose to epitheto\n");

scanf("%s",epith);

 

printf("dose to AFM\n");

scanf("%d",&afm);

 

printf("dose ton arithmo taytotitas\n");

scanf("%s",artau);

/*topothetisi timon sto arxeio*/

fprintf(fpa,"%s %s %d %s",name,epith,afm,artau);

fclose(fpa);

/*anoigei ksana to arxeio*/

if((fpa=fopen("myfile.txt","r"))==NULL)

{

printf("can't opent the file try again\n");

exit(1);

}

/*grafpimo ton zhtoumenon dedomenon*/

fscanf(fpa,"%s %s %d %s",name,epith,&afm,artau);

printf("to proto grama toy onomatos einai:\n %c\n",name[0]);

int x=0;

while(epith[x]!='\0')

{

x++;

 

}

printf("to teleyteo tou epithetou einai:\n %c\n",epith[x-1]);

}

 

Δημοσ.

ok thanks

<img src="http://www.insomnia.gr/ubbthreads/images/graemlins/cool.gif" alt="" /> <img src="http://www.insomnia.gr/ubbthreads/images/graemlins/cool.gif" alt="" />

----------------

Γράφτε Ελληνικά, η γλώσσα μας κινδυνεύει.

 

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

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

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