Re: basic function tell an function
Jean-Christophe <[email protected]>
| Newsgroups | gmane.linux.debian.user |
|---|---|
| Message-ID | <cf57c433e5616aadaced7a3409e74a87eef8ea9f.camel@blues-softwares.net> |
i was think learn code with LLM, the result is that just now way, just
a zero logicial, zero methode and zero undestand on what i do
i just try without LLM after...
On Thu, 2026-08-27 at 20:13 +0000, Jean-Christophe wrote:
> hi bro,
>
> there is my fantastic code don't work, after lot of time to vibe code
>
> i just a stupid man,
>
> i have no idea about what I do and why it doesn't work
>
> cheers
> --
> #include <iostream>
> #include <fstream>
> using namespace std;
>
> bool var_fonction_un = false;
> bool var_fonction_deux = false;
>
> int age=25;
> int bd=100;
> char file;
> char file_write;
>
> string file = "";
> string file_write = "";
>
> string fonction_un() {
> cout << "chocolat" << endl;;
> cout << "chocolat " << age << "ans" << endl;
> cout << "chocolat a environ " << bd << " bandes-dessinées."
> <<
> endl;
>
> file += "chocolat" + endl;
> file += "chocolat" + age + "ans" + endl;
> file += "chocolat a environ " + bd + " bandes dessinées." +
> endl;
>
> //var_fonction_un = true;
> return file;
> }
>
> void fonction_deux (){
> fstream my_file;
> my_file.open("my_file.txt", ios::out);
> if (!MyFile) {
> cout << "File not created!";
> }
> else {
> cout << "File created successfully!\n" << endl;
> MyFile << fonction_un() << endl;
> MyFile << fonction_un() << endl;
> MyFile << fonction_un() << endl;
> MyFile << fonction_un() << endl;
> MyFile << fonction_un() << endl;
>
>
>
>
> MyFile.close();
> }
> //var_fonction_deux = true;
> return file_write;
> }
>
> int main() {
> fonction_deux();
>
> return 0 ;
> }
>
>
>
> On Wed, 2026-08-26 at 19:15 +0000, Jean-Christophe wrote:
> > hello,
> >
> > i try to write an my_files.txt
> >
> > and see the output on tty
> >
> > i see on tty, but no write my_files.txt
> >
> >
> > #include <iostream>
> > #include <fstream>
> > using namespace std;
> >
> > bool var_fonction_un = false;
> > bool var_fonction_deux = false;
> >
> > int age=25;
> > int bd=100;
> >
> >
> > bool fonction_un() {
> > cout << "chocolat" << endl;;
> > cout << "chocolat " << age << "ans" << endl;
> > cout << "chocolat a environ " << bd << " bandes-dessinées."
> > <<
> > endl;
> >
> > var_fonction_un = true;
> > return var_fonction_un;
> > }
> >
> > bool fonction_deux (){
> > fstream my_file;
> > my_file.open("my_file.txt", ios::out);
> > if (!my_file) {
> > cout << "File not created!";
> > }
> > else {
> > cout << "File created successfully!\n" << endl;
> > cout << fonction_un() << endl;
> >
> > my_file.close();
> > }
> > var_fonction_deux = true;
> > return var_fonction_deux;
> > }
> >
> > int main() {
> > fonction_deux();
> >
> > return 0 ;
> > }
> >
> > --
> >
> > https://bpa.st/3PM5U <-- work
> >
> > Anyone know why my program doesn't write my_file.txt?
> >