1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
GrogVix [38]
3 years ago
10

Write a program which can do a String Check if its Panagram or not!

Computers and Technology
1 answer:
slega [8]3 years ago
3 0

Answer:

#include <bits/stdc++.h>

using namespace std;

bool isPangram(string &s) //boolean function to check whether the string is pangram or not...

{

 int a[26]={0};//initializing the array a with zero.

   for(int i=0;i<s.length();i++)

   {

       if(s[i]>='A' && s[i] <= 'Z') //checking for uppercase letters..

       {

           a[s[i]-'A']++;

       }

       else if(s[i]>='a' && s[i] <= 'z')//checking for lowercase letters..

       {

           a[s[i]-'a']++;

       }

   }

   for(int i=0;i<26;i++)//if any value of array a is zero then returning false.

   {

       if(a[i]==0)

       return false;

   }

   return true;

}

int main() {

   string s;

   getline(cin,s);

   bool b=isPangram(s);

   cout<<b<<endl;

return 0;

}

Input:-

abcdefghijklmnopqrstuvwxy z

Output:-

1

Explanation:

Pangram string is a string that contains all the alphabetical letters form a to z.So the above program returns 1 if the string is Pangram and 0 if the string is not pangram.

I have used a function called isPangram of type boolean.In the function I have taken an array of size 26 and initialized it with 0.Then iterating over the string and updating the count in the array a.Then checking if any value in the array a is zero if it is then the answer is false else it is true.

You might be interested in
Modify an array's elements Write a for loop that iterates from 1 to numberSamples to double any element's value in dataSamples t
ValentinkaMS [17]

Answer:

See explaination for program code

Explanation:

%save as AdjustMinValue.m

%Matlab function that takes three arguments

%called number of samples count, user samples

%and min vlaue and then returns a data samples

%that contains values which are double of usersamples

%that less than min vlaue

%

function dataSamples=AdjustMinValue(numberSamples, userSamples, minValue)

dataSamples=userSamples;

%for loop

for i=1:numberSamples

%checking if dataSamples value at index,i

%is less than minValue

if dataSamples(i)<minValue

%set double of dataSamples value

dataSamples(i)= 2*dataSamples(i);

end

end

end

Sample output:

Note:

File name and calling method name must be same

--> AdjustMinValue(4, [2,12,9,20],10)

ans =

4 12 18 20

3 0
3 years ago
Alexa hoped that a good outline will accomplish which of the following for her<br> presentation?
atroni [7]

Answer: A. Help her distinguish between main topics and subtopics.

Explanation: APEX

6 0
3 years ago
Read 2 more answers
Choose the correct item. Check your answers in the text.<br>3​
RSB [31]

Answer:

You should do that

Explanation:

You didnt say anything

5 0
3 years ago
Im building my first gaming pc, got any part suggestions or tips?
ladessa [460]

Answer:

You should find a good game engine that is not hard. Unity and Unreal are some good ones.

You should also search for the programming language you like the most, and use engines that use that specific language.

5 0
3 years ago
Read 2 more answers
g Write a Racket function (process lst1 lst2) that processes the corresponding elements of the two lists and returns a list. If
blagie [28]

Answer:

  1. def process(lst1, lst2):
  2.    newList = []
  3.    for i in range(0, len(lst1)):
  4.        sum = lst1[i] + lst2[i]
  5.        newList.append(sum)
  6.    return newList
  7. list1 = [1, 3, 5, 7, 9]
  8. list2 = [2, 4, 6, 8, 10]
  9. print(process(list1, list2))

Explanation:

Firstly, create a function process that takes two input lists (Line 1). In the function, create a new list (Line 2). Use a for loop to traverse through the elements of the two lists and total up the corresponding elements and add the sum to the new list (Line 3 - 5). At last, return the new list (Line 6).

In the main program, create two sample list and use them as arguments to test the function process (Line 8 - 9). We shall get the output  [3, 7, 11, 15, 19].

8 0
3 years ago
Other questions:
  • What is computer engineering?
    11·1 answer
  • Rebecca received the following e-mail from her boss: I NEED ALL EMPLOYEES TO WORK LATE ON SATURDAY. NO EXCEPTIONS! What is the m
    13·2 answers
  • What is the internet?
    5·2 answers
  • What would be a good hash code for a vehicle identification that is a string of numbers and letters of the form “9x9xx99x9xx9999
    9·1 answer
  • Eliza needs to share contact information with another user, but she wants to include only certain information in the contact. Wh
    9·2 answers
  • What is wrong with this code and correct it.
    12·1 answer
  • Anyone down to play gta later i play on ps4?
    15·2 answers
  • Custom actions help your users by
    6·1 answer
  • Choose the missing words in the code below.
    12·1 answer
  • In a spreadsheet, what is text wrapping used for?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!