| | |
how to count the char you input..
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
hi!
i have a problem..
i want to make a program the will input your name and age, and the output will count the char i been input. but my problem is i don't know what would be the code so that i can count the char i been input..
can someone help me? i dont need the whole program.. i just need the code.. thanks guys.. ^_^
i have a problem..
i want to make a program the will input your name and age, and the output will count the char i been input. but my problem is i don't know what would be the code so that i can count the char i been input..
can someone help me? i dont need the whole program.. i just need the code.. thanks guys.. ^_^
"One more round and it's bottle to the ground"
-NOFX
-NOFX
C++ Syntax (Toggle Plain Text)
int main() { char input[256]; cout << "Insert name: "; cin.getline(input,256); cout << "\nYou name is " << (int)strlen(input) << " characters long.\n"; cin.ignore(); return 0; }
we prefer to use strings with getline but there we go, it's a much more reliable solution since you don't have to worry about size Chris
C++ Syntax (Toggle Plain Text)
string test; getline(cin, test); cout << test.length();
Knowledge is power -- But experience is everything
![]() |
Similar Threads
- Winsock Multi-Client Servers (C++)
- 'Grocery Counter' using Classes (C++)
- Count number of occurrences of a character search it in a file (C++)
- letter and word counter (C)
- C program (not C++) in/out putting a entire sentence (C++)
- Homework Help/Feedback (C++)
- finding the highest value help (C)
- buffer (C)
- Searching in documents... (C++)
Other Threads in the C++ Forum
- Previous Thread: How to adjust class objects through seperate class functions???
- Next Thread: i neEd yOur hElp!!!!!pLeAsE.....
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






