mardi 25 avril 2017

Where is the error in the code ?

 #include "stdafx.h"
 #include <iostream>
 #include <vector>
 #include <string>
 #include <locale>
 #include <sstream>

    std::cout << std::endl;

    std::string wrt = "Was geht ?";

    wrt += "\tAber sicher !";

    wrt.insert(9, ", bruder");

        wrt.length();

        std::cout << wrt << std::endl;
    std::cout << wrt.length() << std::endl;

    wrt.erase(0, 3);

    std::cout << wrt << std::endl;

    int pos = wrt.find("bruder");

    std::cout << pos << std::endl;

    std::cout << (pos == 8) << std::endl;

    std::string::iterator i;

    for ( i = wrt.begin(); i < wrt.end(); i++)
    {

        std::cout << std::endl;

        std::cout << *i;

    }

    std::string zahlen = "42";

    istringstream stream(zahlen);


    int ö;

    stream >> ö;

    std::cout << ö << std::endl;

std::cout << std::endl;

    std::string wrt = "Was geht ?";

    wrt += "\tAber sicher !";

    wrt.insert(9, ", bruder");

        wrt.length();

        std::cout << wrt << std::endl;
    std::cout << wrt.length() << std::endl;

    wrt.erase(0, 3);

    std::cout << wrt << std::endl;

    int pos = wrt.find("bruder");

    std::cout << pos << std::endl;

    std::cout << (pos == 8) << std::endl;

    std::string::iterator i;

--> for ( i = wrt.begin(); i < wrt.end(); i++)

    {

        std::cout << std::endl;

--> std::cout << *i;

    }

    std::string zahlen = "42";

--> istringstream stream(zahlen);

    int ö;

    stream >> ö;

    std::cout << ö << std::endl;

The fat #--> show where the error is. I dont know where the problem is or what I did wrong.

Aucun commentaire:

Enregistrer un commentaire