Answer to Question #16508 in C++ for Ashish
write a c program to ask the users to enter their first and last name and print the name and number of character in it.
1
2012-10-17T09:32:04-0400
#include "stdafx.h"
#include <stdio.h>
using namespace std;
#define MAXNUM 100
int main()
{
char message [MAXNUM];
int numchar;
printf("Type in a your name: ");
gets(message);
for (int i = 0; i < MAXNUM; i++){
if (message[i] != ' '){
numchar++;
}
}
printf ("The number of characters entered is %d
", numchar);
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!
Learn more about our help with Assignments:
C++
Comments
Leave a comment