Exercise #4:
******************************************************************************************
Please Upvote the answer as it matters to me a lot :)
*****************************************************************************************
As per HomeworkLib expert answering guidelines,Experts are supposed to
answer only certain number of questions/sub-parts in a post.Please
raise the remaining as a new question as per HomeworkLib
guidelines.
******************************************************************************************
#include <bits/stdc++.h>
using namespace std;
int alpha(char c)
{
if(((c<='z')&&(c>='a'))||((c<='Z')&&(c>='A')))return
1;
else return 0;
}
int main() {
string s;
getline(cin,s);
cout<<"No of characters are
"<<s.size()<<endl;
int words=0;
for(int i=0;i<s.size();i++)
{
if (alpha(s[i]))
{
while((i<s.size())&&(alpha(s[i])))
{
i++;
}
words++;
}
}
cout<<"No of Words are "<<words<<endl;
reverse(s.begin(),s.end());
cout<<s<<endl;
return 0;
}

Write another function called checkdiag2 (int checkdiag2 (int matrix[][100], int size)) that will return 1 if...
Write another function called checkdiag2 (int checkdiag2 (int matrix[][100], int size)) that will return 1 if all the numbers on the antidiagonal are the same and 0 otherwise.Rewrite your main program to use 2D dynamic allocation instead for your array. Your array will have rows and columns depending of the first integer read from the file.Call your function from the main program. A typical report would look like The matrix is 8x8 and all the numbers on the antidiagonal are the same.Check your...
Write a program that asks the user for a sentence and displays the following four things. They are in increasing order of difficulty.How many characters in that sentence? [12]How many words in that sentence? [3]The sentence backwards [dooG sI efiL]The words (not the letters) shown in reverse order (not mandatory! this one is hard!!) [Good Is Life]
Write a function called arrFactory that takes the address of an int** and two int values, rows and cols. The function will use dynamic memory allocation such that after the function call the int** can be used as a 2D array with the specified number of rows and columns. All elements of the array must be set to 0 within the function without iterating through each element after the array is created. The function has a return type of void....
Done in C++ using visual studio 1. Write a program with one additional function called int[] reverseArray(int array). This function will receive an array from main and then reverse and should return the reversed array to the main to print out. Use a single array and a single loop, you’re are neither allowed to print out just in reverse order nor allowed to use another array variable to store the original array in reverse order. 2. Write a program which...
Write a class named RowSort which has the following members. Private: (1) double matrix 0O (a 2D array): (2) int columns; (3) int rows Public: (1) A default constructor that creates a 2D array, 8 6 4 (2) A constructor that takes three values for the three private members, and creates a 2D array accordingly. (3) The "get" and "set" methods for the three private members. (4) A method that displays a 2D array, stored in the private member matrix,...
USING C++: Write a function that given a 2D dynamic array of integers, will return the number of elements whose absolute value is smaller than a given value x. The function should take as arguments (in this order): a pointer to the array (i.e., 2D dynamic array) the number of rows the number of columns the given value The function should return the number of elements smaller in absolute value than epsilon E.g. if A={{0.2, -0.1, 3.4},{4.4, 0, -2}} and...
Create a class called Lab7b and in it implement all of the methods below. Also, write a main method with test calls to all of these methods. Don’t forget to turn in your file to Canvas before the end of the lab today. int[][] random(int N, int start, int end) returns an N-by-N matrix of random integers ranging from start to end; int rowSum(int[][] a, int i) returns the sum of the elements in row i of the 2-D array...
Given a 2d matrix of size N x M (which must be read from a file provided to you), transpose it into a M x N matrix where N is the number of rows and M is the number of columns. void transpose(int n, int m, const int A[n][m], int AT[m][n]); Write a main() program to test and demonstrate your function. Show your function works for, at minimum, 3x6 and 10x6 matrices.
C++ Write a function called reverseArray(char[] , int) that accepts in an array of chars and the size of the array.as parameters. The function should then create a new array that is the same size as the original array. The function should copy the elements from the first array into the second array in reverse order. So if the initial array is {'a' , 'b', 'c'} then the new array will be {'c', 'b', 'a'} Then in your main(), create...
Java
Here is the template
public class ShiftNumbers {
public static void main(String[] args) {
// TODO: Declare matrix shell size
// TODO: Create first row
// TODO: Generate remaining rows
// TODO: Display matrix
}
/**
* firstRow
*
* This will generate the first row of the matrix, given the size n. The
* elements of this row will be the values from 1 to n
*
* @param size int Desired size of the array
* @return...