logo elektroda
logo elektroda
X
logo elektroda

c++ - A program that displays the number of letters in a word

Yerild 13044 5
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 13536154
    Yerild
    Level 9  
    Hello everyone. I need help in writing a program where I could enter a first and last name, and then the program would print out the number of letters of that first and last name. Unfortunately, I can't write it, I would like some not very complicated code.
  • ADVERTISEMENT
  • #2 13536219
    D12
    Level 14  
    And what can't you do, read the name on the keyboard or count the letters?
  • ADVERTISEMENT
  • #3 13536226
    Yerild
    Level 9  
    Okay, I've managed it :)

    Here is the code (may be useful to someone)

    [code:1:621e19b84e]#include
    #include
    using namespace std;

    int main()
    {
    string st;
    int dl;
    coutst;
    dl=st.length();
    cout
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #5 21313583
    pseudocfoch
    Level 2  
    Why in C++? You can do it in Python easier and fast. Unless you need to repeat this process millions of times, then you may consider C++.
  • #6 21315637
    JacekCz
    Level 42  
    the_fifth_horseman wrote:
    Read the documentation:


    Seriously, you perceive the questioner @Yerild as someone who reads the documentation ?

    Added after 6 [hours] 3 [minutes]:

    Yerild wrote:
    cin>>st;
    dl=st.length();
    cout<< "The number of letters of your name'"<<st<<"' is"<<dlt<<endl;
    .

    Jean-Marie ... does not display number of letters
ADVERTISEMENT