Write C Program Takes Command Line Arguments Prints Original Argument Number Consonants Vo Q43902877

Write a C program that takes command line arguments andprints the original argument with the number of consonants, vowels,and special characters, as well as prints which character makes upthe majority of each argument. Print out the total number ofcharacters of all arguments combined.

Questions:

1. How do I enter multiple exclamation points and have it berecognized as a special character properly? When I input more thanone exclamation point, the compiler thinks there are way morearguments than there are and they aren’t registered as exclamationpoints. For example, when I enter: test!!!!!!.

2. How do I properly implement consonantCheck? The current codedoesn’t print out the correct number of consonants.

3. How do I add the total number of characters of each argumenttogether to get the total number of character of allarguments together? I have the same concern for totalamounts of special characters, consonants, and vowels forcalculations.

Here’s what I have so far:

#include <stdio.h>
#include <string.h>
#include <ctype.h>

void printResults(char *str);
int vowelCheck(char ch);
int specialCheck(char ch);
int consonantCheck(char ch);

int main(int argc, char **argv){
int i = 0;
//go through every argument in command line
for (i = 1; i < argc; i ++)
{
printf(“nargument %d : %s”, i, argv[i]);

//This passes a pointer to the argument to printResults
printResults(argv[i]);
}
return 0;
}

//This checks the characters of the string
void printResults(char *str)
{
int i;

int characteramount=0;

//Trying to get the total amounts of all arguments combined formajority calculations
int totalcharacteramount=0;
int totalspecialcount=0;
int totalvowelcount=0;
int totalconsonantcount=0;

int specialcount=0;

int vowelcount=0;

int consonantcount=0;

//This only goes through each individual argument
for(i=0;i<strlen(str);i++){
//This only counts the amount of characters of each singleargument, not all
//arguments combined.
characteramount++;

if(specialCheck(str[i])==1){

specialcount++;

}

if(vowelCheck(str[i])==1){

vowelcount++;

}

if(consonantCheck(str[i])==1){

consonantcount++;

}

}

printf(“nNumber of consonants: %d, Number of vowels: %d, Numberof special characters: %dn”, consonantcount, vowelcount,specialcount);
printf(“nThe total number of characters: %dn”,totalcharacteramount);

if(totalvowelcount>(totalcharacteramount/2))
printf(“n The majority character in argument %d is vowels.n”,str[i])

if(totalspecialcount>(totalcharacteramount/2))
printf(“n The majority character in argument %d is specialcharacters.n”, str[i])

if(totalconsonantcount>(totalcharacteramount/2))
printf(“n The majority character in argument %d is consonants.n”,str[i])

}

int vowelCheck(char ch)
{

if (ch == ‘i’ || ch == ‘a’ || ch == ‘o’ || ch == ‘e’ ||
ch == ‘u’ || ch == ‘I’ || ch == ‘A’ || ch == ‘E’ ||
ch == ‘U’ || ch == ‘O’) return 1;

return 0;
}

int specialCheck(char ch)
{
if(!isalpha(ch) && !isdigit(ch)){
return 1;

}
return 0;
}

int consonantCheck(char ch)
{
if (ch != ‘i’&& ch != ‘a’ && ch != ‘o’ &&ch != ‘e’ &&
ch != ‘u’ && ch != ‘I’ && ch != ‘A’ && ch!= ‘E’ &&
ch != ‘U’&& ch != ‘O’)

return 1;

//I also tried the following, but it still doesn’t workingif(isalpha(c)){
if(isVowel(c)==0){
    return 1;
}
}

return 0;

}

Expert Answer


Answer to Write a C program that takes command line arguments and prints the original argument with the number of consonants, vowe…

Write C Program Takes Three Arguments Start Temperature Celsius End Temperature Celsius St Q43854582

Write a C program that takes in threearguments, a start temperature (in Celsius), an end temperature (inCelsius) and a step size. Print out a table that goes from thestart temperature to the end temperature, in steps of the step sizeand print the temprature in fahrenheit ; you do not actually needto print the final end temperature if the step size does notexactly match.

Expert Answer


Answer to Write a C program that takes in three arguments, a start temperature (in Celsius), an end temperature (in Celsius) and a…

Write C Program Takes Three Integer Numbers User Find Largest Number Among Q43877395

Write C program that takes three integer numbers from user andfind largest number among them.

Expert Answer


Answer to Write C program that takes three integer numbers from user and find largest number among them….

Write C Program Two Arrays 1 Read 100 Student Numbers Test Scores Keyboard Provide Method Q43823617

Write a C++ program (with two arrays) to: 1. Read up to 100 student numbers and test scores from the keyboard (provide a methWrite a C++ program (with two arrays) to: 1. Read up to 100 student numbers and test scores from the keyboard (provide a method to end the input before reaching 100 records); 2. Display the student numbers and scores in a two column format on the screen; 3. Sort the list according to test scores; 2. Display the student numbers and scores in a two column format on the screen. For example: The list entered: 101 89 102 95 103 76 The list sorted by test scores: 103 76 89 101 102 95 Show transcribed image text Write a C++ program (with two arrays) to: 1. Read up to 100 student numbers and test scores from the keyboard (provide a method to end the input before reaching 100 records); 2. Display the student numbers and scores in a two column format on the screen; 3. Sort the list according to test scores; 2. Display the student numbers and scores in a two column format on the screen. For example: The list entered: 101 89 102 95 103 76 The list sorted by test scores: 103 76 89 101 102 95

Expert Answer


Answer to Write a C++ program (with two arrays) to: 1. Read up to 100 student numbers and test scores from the keyboard (provide a…

Write C Program Use Function Check Given Two Strings Palindromes Q43854564

Write a C program that use function to check ifgiven two strings are palindromes.

Expert Answer


Answer to Write a C program that use function to check if given two strings are palindromes….

Write C Program Uses Function Return Maximum Minimum Values Array One Function Using Point Q43834698

please answer this question with a full explaintion of thework,thaks in advance
Write a C program that uses a function to return the maximum and minimum values in an array both in one function using pointe
Write a C program that uses a function to return the maximum and minimum values in an array both in one function using pointers. Show transcribed image text Write a C program that uses a function to return the maximum and minimum values in an array both in one function using pointers.

Expert Answer


Answer to Write a C program that uses a function to return the maximum and minimum values in an array both in one function using p…

Write C Program Uses Function Return Maximum Minimum Values Array One Function Using Point Q43854641

Write a C program that uses a function to return the maximum and minimum values in an array both in one function using pointe

A C program please not C++
Thanks in advance

Write a C program that uses a function to return the maximum and minimum values in an array both in one function using pointers. Show transcribed image text Write a C program that uses a function to return the maximum and minimum values in an array both in one function using pointers.

Expert Answer


Answer to Write a C program that uses a function to return the maximum and minimum values in an array both in one function using p…

Write C Program Uses Function Search Specific Value Two Dimensional Array Using Quick Sear Q43838225

Write a C program that is uses a function to searchfor a specific value in a two dimensional array using quicksearch

Expert Answer


Answer to Write a C program that is uses a function to search for a specific value in a two dimensional array using quick search…

Write C Program Uses Function Search Specific Value Two Dimensional Array Using Quick Sear Q43854657

Write a C program that is uses afunction to search for a specific value in a two dimensional arrayusing quick search

A C program please not C++
Thanks in

Expert Answer


Answer to Write a C program that is uses a function to search for a specific value in a two dimensional array using quick search A…

Write C Program Uses Function Sort Array Decreasing Order Please Make Solution Writing Pho Q43789251

Write a C program that uses a function to sort an array indecreasing order
Please make the solution here as writing  NOTPHOTO
TRY to make the solution as clear as you can ..
thank you in advance

Expert Answer


Answer to Write a C program that uses a function to sort an array in decreasing order Please make the solution here as writing NOT…