Answer to Question #255165 in C++ for jersonjangerona

Question #255165
Prepare a c++ program of determining how many character/s in the phrase (inputting any phrase) and counts all the characters in the phrase of the sample run below. Sample run1: Hello!!! Please enter any phrase and I will count how many characters in it. _you are the love of my life. (user input) The characters in the phrase is 27. Thank you. So, what is the character at position 10 ? The character at position 10 is e
1
Expert's answer
2021-10-22T16:47:35-0400
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include<string.h>
using namespace std;
int main()
{
    char str[100];
    int i,CharT;
    CharT=0;
    cout<<"Input the string to count\n";
    gets(str);
    for(i=0; str[i] != '\0'; i++){
            CharT++;
        
    }
    cout<<"The total characters of the given string= "<<CharT;
    getch();
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS