|
|
| Auteur | Message |
|---|
ertow Très bonne participation

Inscrit le : 13 Jan 2007 Messages : 157 : ────────── : Avancement :
  (0/100)
 | Sujet: C++ Sam 3 Mar - 14:03 | |
| en c++ comment faire pour que l utilisateur(celui qui utilise le programe quand il est terminer)quand il ecrit des mot les mot sois stocker sur la variable i
merci d avance  |
|
 | |
Rem_101 *Excellent utilisateur*

Age : 16 Inscrit le : 11 Jan 2006 Messages : 3396 Localisation : chez votre marchand de journaux : ────────── : Avancement :
  (0/100)
 | Sujet: Re: C++ Sam 3 Mar - 14:38 | |
| sa s'apelle keyloger et c'est interdit... _________________
 |
|
 | |
Olympe Utilisateur confirmé: Rang *****

Age : 17 Inscrit le : 14 Mai 2006 Messages : 2769 Localisation : Queq' part : ────────── : Projet Actuel : L'élévation spirituelle. Avancement :
  (0/100)
 | Sujet: Re: C++ Sam 3 Mar - 14:41 | |
| Qu'est ce que tu baves Rem?
Ertow, je te conseille d'aller voir les tutos du Site Du Zéro, tu y trouveras ton bonheur.  _________________ Caraï an caldazar ! |
|
 | |
alpha - Modérateur -

Age : 106 Inscrit le : 29 Avr 2005 Messages : 4559 Localisation : INTERNAL SERVOR ERROR : ────────── : Projet Actuel : Installer la SDL dans PSPDEV. Avancement :
  (0/100)
 | Sujet: Re: C++ Sam 3 Mar - 14:41 | |
| | Rem_101 a écrit: | | sa s'apelle keyloger et c'est interdit... |
rem, ce n'est en rien un keyloger, _________________ War, War never changes.
The end of the world occurred pretty much as we had predicted. Too many humans, not enough space or resources to go around. The details are trivial and pointless, the reasons, as always, purely human ones. The earth was nearly wiped clean of human life. A great cleansing, an atomic spark struck by human hands, quickly raged out of control. Spears of nuclear fire rained from the skies. Continents were swallowed in flames and fell beneath the boiling oceans. |
|
 | |
alpha - Modérateur -

Age : 106 Inscrit le : 29 Avr 2005 Messages : 4559 Localisation : INTERNAL SERVOR ERROR : ────────── : Projet Actuel : Installer la SDL dans PSPDEV. Avancement :
  (0/100)
 | Sujet: Re: C++ Sam 3 Mar - 14:42 | |
| lol posté en même temps _________________ War, War never changes.
The end of the world occurred pretty much as we had predicted. Too many humans, not enough space or resources to go around. The details are trivial and pointless, the reasons, as always, purely human ones. The earth was nearly wiped clean of human life. A great cleansing, an atomic spark struck by human hands, quickly raged out of control. Spears of nuclear fire rained from the skies. Continents were swallowed in flames and fell beneath the boiling oceans. |
|
 | |
Rem_101 *Excellent utilisateur*

Age : 16 Inscrit le : 11 Jan 2006 Messages : 3396 Localisation : chez votre marchand de journaux : ────────── : Avancement :
  (0/100)
 | Sujet: Re: C++ Sam 3 Mar - 14:55 | |
| ah marde je croyais qu'il avait dit qu'and j'étein mon logiciel, lol MDR desolé. _________________
 |
|
 | |
notiz85 Utilisateur confirmé: Rang *****

Age : 14 Inscrit le : 05 Avr 2006 Messages : 1998 Localisation : De retour ici, avec un jeu... : ────────── : Projet Actuel : Tenu Secret Avancement :
   (2/100)
 | |
 | |
ertow Très bonne participation

Inscrit le : 13 Jan 2007 Messages : 157 : ────────── : Avancement :
  (0/100)
 | Sujet: merci Dim 4 Mar - 21:05 | |
| merci un derniere question comment metre le resultat de sa "scanf("%ld");" la ou c est ecrit
| Citation: | #ifdef HAVE_CONFIG_H #include <config.h> #endif
#include <iostream> #include <cstdlib>
using namespace std; main(void) { FILE *fichier; scanf("%ld"); fichier = fopen("comment mettre ici le resultat de scanf("%ld");", "w+");
system("PAUSE"); return 0;
} |
|
|
 | |
notiz85 Utilisateur confirmé: Rang *****

Age : 14 Inscrit le : 05 Avr 2006 Messages : 1998 Localisation : De retour ici, avec un jeu... : ────────── : Projet Actuel : Tenu Secret Avancement :
   (2/100)
 | Sujet: Re: C++ Dim 4 Mar - 21:28 | |
| | ertow a écrit: | merci un derniere question comment metre le resultat de sa "scanf("%ld");" la ou c est ecrit
| Citation: | #ifdef HAVE_CONFIG_H #include #endif
#include #include
using namespace std; main(void) { FILE *fichier; scanf("%ld"); fichier = fopen("comment mettre ici le resultat de scanf("%ld");", "w+");
system("PAUSE"); return 0;
} |
|
... la fonction scanf est du C et non du C++ et je n'ai pas vu malheureusement le C! Donc... Sinon avec cout << et cin >> tu peux le faire comme dans mon code normalement. Tu veux bien faire apparaître une variable.  _________________

 |
|
 | |
Blizter Utilisateur confirmé: Rang *****
Inscrit le : 29 Aoû 2005 Messages : 2004 : ────────── : Avancement :
  (0/100)
 | Sujet: Re: C++ Dim 4 Mar - 22:25 | |
| | Citation: | ... la fonction scanf est du C et non du C++ et je n'ai pas vu malheureusement le C! Donc... Sinon avec cout << et cin >> tu peux le faire comme dans mon code normalement. Tu veux bien faire apparaître une variable.  |
scanf peut aussi être utiliser en c++........ |
|
 | |
Gab666 Modérateur 'Zut' & 'Ablationer'

Age : 17 Inscrit le : 02 Aoû 2005 Messages : 5276 Localisation : **I move away from the mic to breathe in : ────────── : Avancement :
  (0/100)
 | Sujet: Re: C++ Lun 5 Mar - 3:57 | |
| | ertow a écrit: | merci un derniere question comment metre le resultat de sa "scanf("%ld");" la ou c est ecrit
| Citation: | #ifdef HAVE_CONFIG_H #include <config.h> #endif
#include <iostream> #include <cstdlib>
using namespace std; main(void) { FILE *fichier; scanf("%ld"); fichier = fopen("comment mettre ici le resultat de scanf("%ld");", "w+");
system("PAUSE"); return 0;
} |
|
scanf prend comme premier parametre le format d'une chaine exemple
scanf("%ld",&caca); où il va attendre un nombre qui va placer dans caca
ou bien
scanf("%ld,%ld",&caca,&caca2); où il va attendre disons 12,41 et il va les placer dans caca et caca2 respectivement
il attend comme parametres suivant le format de la chaine un pointeur(ou l'addresse d'une variable)
ensuite pour le stocker dans un fichier tu fait FILE *pointeur_vers_ton_fichier = fopen("ton fichier","r+"); ou bien w+ ou w ou r dépendement de ce que tu veux faire fprintf(pointeur_vers_ton_fichier,"%ld",caca); où il va mettre la valeur de caca dans le fichier
donc si tu veux du code tout cru :
| Spoiler: | | | FILE *fichier = NULL; long caca = 0; scanf("%ld",&caca); fichier = fopen("ton fichier","r+"); if(fichier != NULL) { fprintf(fichier,"%ld",caca); fclose(fichier); } else { printf("ERREUR LORS DE L'OUVERTURE DU FICHIER PROCEDURE D'URGENCE LOLOLOLOLOLOLOLOLOLOL PESES SUR N'IMPORTE QUELLE TOUCHE POUR QUITTER LE PROGRAMMEZ0R"); system("PAUSE"); exit(0); }
|
J'ai pas testé mais ça devrait fonctionner |
|
 | |
|