Complete homework Question is this:
Create a program that uses a do-while loop to count the number of char.
(not including whitespace) entered by the user.The count should end
when it encounters a # character in the input.
First of all i want to tell u that I am a bigenner.Just started C++ for
a month.
And that is what i have tried:
#include<iostream.h>
void main()
{
char character;
int i=1;
cout<<"enter the character "<<endl;
do
{
cin>>character;
i++;
}while(character!='#');
cout<<"the no. of characters you have entered are "<<i<<endl;
}
Output:
it is 80% right result but it counts two characters more than I have
written.....
hints welcomed.