|
|
Auteur | Message |
---|
ProgVal modérateur
Nombre de messages : 4107 Age : 173 Localisation : In da cloud items : o Personalized field : Réputation : -4 Points : 6738 Date d'inscription : 09/08/2007
Profil TI: V200 - NSpire TO: 120 [2352 - 2%] Spécialité: Programmation web
| Sujet: C Jeu 30 Aoû 2007, 18:36 | |
| Bonjour, je n'ai quasiment aucune connaissance en C. J'utilise TIGCC. J'aimerai savoir utiliser: 1.Si je veux que x val 1 je dois taper 1=x ou x=1 ? [résolu (aide TIGCC)] 2.boucles For [résolu (aide TIGCC)] 3.arguments à l'appel du programme 4.retourner 1 matrice 5.manipuler des matrices [résolu (tutorial squalenet)] 6.condition [résolu (aide TIGCC)]
PS: c'est pour un jeu de la vie. Je l'ai fait en Basic, mais bon, la vitesse laisse à désirer (1 minute de calcul pour un format 9*9) |
|
| |
ProgVal modérateur
Nombre de messages : 4107 Age : 173 Localisation : In da cloud items : o Personalized field : Réputation : -4 Points : 6738 Date d'inscription : 09/08/2007
Profil TI: V200 - NSpire TO: 120 [2352 - 2%] Spécialité: Programmation web
| Sujet: Re: C Ven 31 Aoû 2007, 11:18 | |
| Si quelqu'un veut bien m'aider... Voici mon code: - Spoiler:
- Code:
-
int main(int a;int b;short* mat1) { short mat2[a][b]; int x; int y; x=1; for(x=1;a-x=0;x++) { for(y=1,b-y=0,y++ { if (x>1) mat2[x][y] = mat2[x][y]+mat1[x-1][y]; if (x<a) mat2[x][y] = mat2[x][y]+mat1[x+1][y]; if (y>1) mat2[x][y] = mat2[x][y]+mat1[x][y-1]; if (y<b) mat2[x][y] = mat2[x][y]+mat1[x][y+1]; } } for x,1,a { for y,1,b { if (mat2[x][y]=2) { mat1[x][y] = 1; } else { mat1[x][y] = 0; } } } return mat1 }
Voici les erreurs: - Spoiler:
- Code:
-
Type of 'a' defaults to 'int'. Type of 'b' defaults to 'int'. Type of 'mat1' defaults to 'int'. Invalid lvalue in assignment. Invalid lvalue in assignment. Value computed is not used. Value computed is not used. Expected ';' before '{' token. Expected expression before '}' token. Expected expression before '}' token. Expected expression before '}' token. Expected '(' before 'x'. Left-hand operand of comma expression has no effect. Left-hand operand of comma expression has no effect. Statement with no effect. Unused variable 'mat2'. Unused parameter 'mat1'. Control reaches end of non-void function.
|
|
| |
tama Admin
Nombre de messages : 12376 Age : 32 Localisation : DTC ? :triso: Humeur : =) items : o Personalized field : huh ? oO Réputation : 3 Points : 9457 Date d'inscription : 08/08/2007
Profil TI: 84+, 89 tita, 89 tita TO: infini :p Spécialité: C 68k
| Sujet: Re: C Ven 31 Aoû 2007, 13:40 | |
| 1.ok 2.ok 3.Pour les arguments c'est pas comme ça il faut plutôt regarder du côté de args.h dans l'aide de TIGCC et particulièrement InitArgPtr 4.Pour retourner une matrice c'est plus compliqué il faut définir au tout début du programme - Code:
-
#define RETURN_VALUE
puis mettre les éléments en sens inverse grâce à des instructions spéciales par exemple pour la matrice : - Code:
-
1 2 3 4 5 6 7 8 9 10 11 12
ça donnera - Code:
-
#define RETURN_VALUE #include <tigcclib.h>
void _main() { push_END_TAG(); //3ème ligne push_shortint(12); push_shortint(11); push_shortint(10); push_shortint(9); push_LIST_TAG(); //fin de la 3ème ligne push_END_TAG(); //2ème ligne ... push_LIST_TAG(); //fin de la 2ème ligne push_END_TAG(); //1ère ligne ... push_LIST_TAG(); //fin de la 1ère ligne }
ou sinon tu peux écrire directement dans un fichier, reporte toi alors à fopen, fputc/fputs, fread, fgetc, fclose ... 5.ok 6.ok |
|
| |
ProgVal modérateur
Nombre de messages : 4107 Age : 173 Localisation : In da cloud items : o Personalized field : Réputation : -4 Points : 6738 Date d'inscription : 09/08/2007
Profil TI: V200 - NSpire TO: 120 [2352 - 2%] Spécialité: Programmation web
| Sujet: Re: C Ven 31 Aoû 2007, 17:09 | |
| Le problème, c'est que ma matrice est de taille a et b |
|
| |
tama Admin
Nombre de messages : 12376 Age : 32 Localisation : DTC ? :triso: Humeur : =) items : o Personalized field : huh ? oO Réputation : 3 Points : 9457 Date d'inscription : 08/08/2007
Profil TI: 84+, 89 tita, 89 tita TO: infini :p Spécialité: C 68k
| Sujet: Re: C Ven 31 Aoû 2007, 18:03 | |
| bah - Code:
-
for(y=0;y<=b;y++) { push_END_TAG(); for(x=0;x<=a;x++) push_shortint(mat[a][b]); push_LIST_TAG(); }
en supposant que mat est une matrice qui contient tes données |
|
| |
AdRiWeB amis
Nombre de messages : 3655 Age : 31 Localisation : Juste sous mes cheveux Loisirs : Internet, programmation, TI, musique, tennis-de-table ... Humeur : ^^ items : o Personalized field : Réputation : 0 Points : 6298 Date d'inscription : 12/08/2007
Profil TI: TI-84 Plus, nspire CAS TO: 2429 {2} Spécialité: Basic z80
| Sujet: Re: C Ven 31 Aoû 2007, 18:27 | |
| ben voyons, comme si c'était naturelle ^^ |
|
| |
tama Admin
Nombre de messages : 12376 Age : 32 Localisation : DTC ? :triso: Humeur : =) items : o Personalized field : huh ? oO Réputation : 3 Points : 9457 Date d'inscription : 08/08/2007
Profil TI: 84+, 89 tita, 89 tita TO: infini :p Spécialité: C 68k
| Sujet: Re: C Sam 01 Sep 2007, 01:54 | |
| adriweb tu sors |
|
| |
ProgVal modérateur
Nombre de messages : 4107 Age : 173 Localisation : In da cloud items : o Personalized field : Réputation : -4 Points : 6738 Date d'inscription : 09/08/2007
Profil TI: V200 - NSpire TO: 120 [2352 - 2%] Spécialité: Programmation web
| Sujet: Re: C Sam 01 Sep 2007, 12:55 | |
| Ouais! Un candidat en moins pour le poste de vice-admin! |
|
| |
tama Admin
Nombre de messages : 12376 Age : 32 Localisation : DTC ? :triso: Humeur : =) items : o Personalized field : huh ? oO Réputation : 3 Points : 9457 Date d'inscription : 08/08/2007
Profil TI: 84+, 89 tita, 89 tita TO: infini :p Spécialité: C 68k
| Sujet: Re: C Sam 01 Sep 2007, 14:27 | |
| ça n'augmente pas tes chances pour autant |
|
| |
AdRiWeB amis
Nombre de messages : 3655 Age : 31 Localisation : Juste sous mes cheveux Loisirs : Internet, programmation, TI, musique, tennis-de-table ... Humeur : ^^ items : o Personalized field : Réputation : 0 Points : 6298 Date d'inscription : 12/08/2007
Profil TI: TI-84 Plus, nspire CAS TO: 2429 {2} Spécialité: Basic z80
| Sujet: Re: C Sam 01 Sep 2007, 16:26 | |
| lol ^^
moi c'est pas pour etre vice-admin, mais etre modo ^^ |
|
| |
tama Admin
Nombre de messages : 12376 Age : 32 Localisation : DTC ? :triso: Humeur : =) items : o Personalized field : huh ? oO Réputation : 3 Points : 9457 Date d'inscription : 08/08/2007
Profil TI: 84+, 89 tita, 89 tita TO: infini :p Spécialité: C 68k
| Sujet: Re: C Sam 01 Sep 2007, 17:38 | |
| tu l'es déjà...de tes projets ^^ |
|
| |
AdRiWeB amis
Nombre de messages : 3655 Age : 31 Localisation : Juste sous mes cheveux Loisirs : Internet, programmation, TI, musique, tennis-de-table ... Humeur : ^^ items : o Personalized field : Réputation : 0 Points : 6298 Date d'inscription : 12/08/2007
Profil TI: TI-84 Plus, nspire CAS TO: 2429 {2} Spécialité: Basic z80
| Sujet: Re: C Sam 01 Sep 2007, 19:28 | |
| |
|
| |
ProgVal modérateur
Nombre de messages : 4107 Age : 173 Localisation : In da cloud items : o Personalized field : Réputation : -4 Points : 6738 Date d'inscription : 09/08/2007
Profil TI: V200 - NSpire TO: 120 [2352 - 2%] Spécialité: Programmation web
| Sujet: Re: C Sam 01 Sep 2007, 19:42 | |
| Je crois que je vais abandonner mon truc, j'ai déjà commencé (3 jours) à plancher sur du calcul partagé: la V200 retarde le truc, même quand elle a beaucoup moins à faire que la 92+... |
|
| |
tama Admin
Nombre de messages : 12376 Age : 32 Localisation : DTC ? :triso: Humeur : =) items : o Personalized field : huh ? oO Réputation : 3 Points : 9457 Date d'inscription : 08/08/2007
Profil TI: 84+, 89 tita, 89 tita TO: infini :p Spécialité: C 68k
| Sujet: Re: C Sam 01 Sep 2007, 22:05 | |
| pourtant la v200 doit être plus rapide que la 92+ ? (enfin il me semble) |
|
| |
AdRiWeB amis
Nombre de messages : 3655 Age : 31 Localisation : Juste sous mes cheveux Loisirs : Internet, programmation, TI, musique, tennis-de-table ... Humeur : ^^ items : o Personalized field : Réputation : 0 Points : 6298 Date d'inscription : 12/08/2007
Profil TI: TI-84 Plus, nspire CAS TO: 2429 {2} Spécialité: Basic z80
| Sujet: Re: C Sam 01 Sep 2007, 22:31 | |
| |
|
| |
tama Admin
Nombre de messages : 12376 Age : 32 Localisation : DTC ? :triso: Humeur : =) items : o Personalized field : huh ? oO Réputation : 3 Points : 9457 Date d'inscription : 08/08/2007
Profil TI: 84+, 89 tita, 89 tita TO: infini :p Spécialité: C 68k
| Sujet: Re: C Dim 02 Sep 2007, 14:35 | |
| faudrait chercher...mais à mon avis vu quand est sortie la v200 par rapport à la TI92+ |
|
| |
ProgVal modérateur
Nombre de messages : 4107 Age : 173 Localisation : In da cloud items : o Personalized field : Réputation : -4 Points : 6738 Date d'inscription : 09/08/2007
Profil TI: V200 - NSpire TO: 120 [2352 - 2%] Spécialité: Programmation web
| Sujet: Re: C Mar 04 Sep 2007, 11:42 | |
| euh, environ 0,25 Mhz, sur les 13,25Mhz de la V200.
Et j'ai fait un petit test avec un graphisme 3D, la TI-92+ a fini 1 seconde avant la V200 (elle a mit 16 secondes) |
|
| |
AdRiWeB amis
Nombre de messages : 3655 Age : 31 Localisation : Juste sous mes cheveux Loisirs : Internet, programmation, TI, musique, tennis-de-table ... Humeur : ^^ items : o Personalized field : Réputation : 0 Points : 6298 Date d'inscription : 12/08/2007
Profil TI: TI-84 Plus, nspire CAS TO: 2429 {2} Spécialité: Basic z80
| Sujet: Re: C Mar 04 Sep 2007, 12:38 | |
| |
|
| |
tama Admin
Nombre de messages : 12376 Age : 32 Localisation : DTC ? :triso: Humeur : =) items : o Personalized field : huh ? oO Réputation : 3 Points : 9457 Date d'inscription : 08/08/2007
Profil TI: 84+, 89 tita, 89 tita TO: infini :p Spécialité: C 68k
| Sujet: Re: C Mar 04 Sep 2007, 12:55 | |
| la TI89 tita HW4 tourne à 16.1 MHz (testé) |
|
| |
ProgVal modérateur
Nombre de messages : 4107 Age : 173 Localisation : In da cloud items : o Personalized field : Réputation : -4 Points : 6738 Date d'inscription : 09/08/2007
Profil TI: V200 - NSpire TO: 120 [2352 - 2%] Spécialité: Programmation web
| Sujet: Re: C Mar 04 Sep 2007, 13:00 | |
| |
|
| |
tama Admin
Nombre de messages : 12376 Age : 32 Localisation : DTC ? :triso: Humeur : =) items : o Personalized field : huh ? oO Réputation : 3 Points : 9457 Date d'inscription : 08/08/2007
Profil TI: 84+, 89 tita, 89 tita TO: infini :p Spécialité: C 68k
| Sujet: Re: C Mar 04 Sep 2007, 13:01 | |
| =P la TI84+ tourne à 15 MHz selon les chiffres mais j'ai pas testé |
|
| |
ProgVal modérateur
Nombre de messages : 4107 Age : 173 Localisation : In da cloud items : o Personalized field : Réputation : -4 Points : 6738 Date d'inscription : 09/08/2007
Profil TI: V200 - NSpire TO: 120 [2352 - 2%] Spécialité: Programmation web
| Sujet: Re: C Mar 04 Sep 2007, 13:07 | |
| Et la TI-80? (tu peux pas trouver, y'a pas d'Assembleur dessus!) |
|
| |
tama Admin
Nombre de messages : 12376 Age : 32 Localisation : DTC ? :triso: Humeur : =) items : o Personalized field : huh ? oO Réputation : 3 Points : 9457 Date d'inscription : 08/08/2007
Profil TI: 84+, 89 tita, 89 tita TO: infini :p Spécialité: C 68k
| Sujet: Re: C Mar 04 Sep 2007, 13:11 | |
| (bah si y a les chiffres officiels -_-') 6 MHz |
|
| |
AdRiWeB amis
Nombre de messages : 3655 Age : 31 Localisation : Juste sous mes cheveux Loisirs : Internet, programmation, TI, musique, tennis-de-table ... Humeur : ^^ items : o Personalized field : Réputation : 0 Points : 6298 Date d'inscription : 12/08/2007
Profil TI: TI-84 Plus, nspire CAS TO: 2429 {2} Spécialité: Basic z80
| Sujet: Re: C Mer 05 Sep 2007, 14:30 | |
| - tama a écrit:
- la TI84+ tourne à 15 MHz selon les chiffres mais j'ai pas testé
J'confirme |
|
| |
tama Admin
Nombre de messages : 12376 Age : 32 Localisation : DTC ? :triso: Humeur : =) items : o Personalized field : huh ? oO Réputation : 3 Points : 9457 Date d'inscription : 08/08/2007
Profil TI: 84+, 89 tita, 89 tita TO: infini :p Spécialité: C 68k
| Sujet: Re: C Mer 05 Sep 2007, 15:13 | |
| |
|
| |
Contenu sponsorisé
| Sujet: Re: C | |
| |
|
| |
|