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!

Search & Filtering

4. Write a program to count number of words in string
//3. Read in characters from the user until user enters 'z', then print out how many a's were entered

Please see the below code. However the code is not counting the number of 'a' the user has inputted.
Would I have to use array? or is there a way to do it without array if yes please help me thanks.


#include <iostream>

using namespace std;

void main ()
{

char letter;
int x=0;


cout << "Please enter letter(s): ";
cin >> letter;

while (letter=='a')
{
x = letter+1;

if (letter!= 'z')
{
cin >> letter;

}

}

cout << "The number(s) of letter 'a' entered is/are: " << x << endl;
system ("pause");

}
//3. Read in characters from the user until user enters 'z', then print out how many a's were entered

The below program does not count the number of 'a' the user has inputted. Please see the code below.

Do I need to use array or I can do it without array, if yes please let me know how without using array.


#include <iostream>

using namespace std;

void main ()
{

char letter;
int x=0;


cout << "Please enter letter(s): ";
cin >> letter;

while (letter=='a')
{
x = letter+1;

if (letter!= 'z')
{
cin >> letter;

}

}

cout << "The number(s) of letter 'a' entered is/are: " << x << endl;
system ("pause");

}
In a new role-playing fantasy game players must design their character by picking a point value for each of three characteristics:
• Strength, from 1 to 10
• Health, from 1 to 10
• Luck, from 1 to 10
Write a program that asks for a name for the character and asks for the point value of for each of the three characteristics. However, the total points must be less than 15. If the total exceeds 15, then 5 points are assigned to each characteristic
Welcome to Jack Bagbaga’s Quest
Enter the name of your character: Chortle
Enter strength (1-10): 8
Enter health (1-10): 4
Enter luck (1-10): 6

You have give your character too many points! Default values have been assigned:
Chortle, strength: 5, health: 5, luck: 5
You were hired as a programmer by TNP (Telepono ng Pilipino) a phone company. TNP employs a metering scheme in computing the telephone bill. The metering scheme is as follows: Calls made on a weekday between 6:00 AM to 6:00 PM are charged at 2.50 pesos per minute. Charges made at other times during a weekday are charged a discounted rate of 2.00 pesos per minute. Calls made anytime on a weekend are charged a weekend rate of 1.50 pesos per minute. Your job is to write a program that will ask the user to enter the following information: (a) an integer representing the day the call was made, let 1 represent Monday, 2 represent Tuesday and so on, (b) an integer representing the time (in 24 hour format) the call started (c) an integer representing the length of time or duration of the call in minutes (assume that all calls are rounded to the next minute, i.e, a call lasting 2 minutes and 35 seconds is billed as a 3 minute call). The rate applied depends on the day the call was made and on the time the call was
Write a program that calculates the annual cost of running an appliance. The program will ask the user for the cost per kilowatt-hour and the number of kilowatt-hours the appliance uses in a year:
Enter cost per kilowatt-hour in cents: 8.42
Enter kilowatt-hours used per year : 653
Annual cost: 54.9826
Write a C++ program to input the following numbers into an array named grades: 89, 95, 72, 83, 99, 54, 86, 75, 92, 73, 79, 75, 82, 73. As each member is input, add the numbers to a total. After all numbers are input and the total is obtained, calculate the average of the numbers and use the average to determine the deviation of each from the average. Store each deviation in an array named deviation. Each deviation is obtained as the element value less the average of all the data. Have your program display each deviation alongside its corresponding element from the grades array.
Calculate the variance of the data.
, Write, compile and execute a C++ program that calculates the distance between two points whose coordinates are (7, 12) and (3, 9). When you have verified that your program works correctly, by calculating the distance between the two points manually, use your program to determine the distance between the points (-12, -15) and (22, 5).
i want to write a program in cpp and same in for android mobiles(or in java) regarding wallet management(adding /removing/editing/viewing monthly detailed expenditure)
can u plz convert this c++ program into a program for android mobiles

#include<graphics.h>
#include<fstream.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<iomanip.h>
#include<stdio.h>
#include<process.h>
int a,no;
void page_1();
void page_2();
void pass();
void detail();
void info();
void enter();
void today();
void month();
void total();
void reset();
struct wallet
{long int spent;
int date,month,year;
char ph[11],name[25],add[50],des[30];
}w;
void page_1()
{clrscr();
cout<<"\n\n\n\n\n\n\n\t\t\t ßßßßß WALLET RECORD ßßßß";
cout<<"\n\n\t\t\t Developer: Ankur & Ankit";
cout<<"\n\t\t\t Programing Language: C++";
cout<<"\n\t\t\t Year: 2014-15";
cout<<"\n\n\t\t\t AT NAVY CHILDREN SCHOOL";
cout<<"\n\n\t\t\t %%%%%%%%%%%%%%%%%%%%%%%%%";
cout<<"\n\n\n\tPress enter to continue";
getch();
}
void page_2()
{clrscr();
int n;
cout<<"\n\n\t\t\t\t MENU:";
cout<<"\n\n\n\t\t\t1)Edit account details";
cout<<"\n\t\t\t2)Enter money spent today";
cout<<"\n\t\t\t3)View money spent
LATEST TUTORIALS
APPROVED BY CLIENTS