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
Natali [406]
3 years ago
15

Assign True to the variable has_dups if the string s1 has any duplicate character (that is if any character appears more than on

ce) and False otherwise.
Computers and Technology
1 answer:
podryga [215]3 years ago
4 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   string s;

   cin>>s;    //reading string

   int i,j;

   bool has_dups=false;

   int n= s.length();

   for(i=0;i<n;i++)  //to check for duplicate characters

   {

       for(j=0;j<n;j++)

       {

           if(j!=i && s[i]==s[j])  //to check if it is matched with itself

           {

               has_dups=true;  //if true no need to check others

               break;

           }

       }

   }

   cout<<has_dups;

   return 0;

}

OUTPUT :

California

1

Explanation:

Above program finds if a character repeat itself in the string entered by user.

You might be interested in
In addition to developing sketches, computer-aided design programs are used by fashion designers to perform which task?
nikdorinn [45]

Answer:

flat drawing, pattern making development, computerized marker planning and many other fashion designing related aspects.

Explanation:

6 0
2 years ago
Convert to binary140
marshall27 [118]

00110001 00110100 00110000

5 0
3 years ago
What are two software tools for bank account reconciliation?
AysviL [449]

Answer: cashbook and erp system

Explanation:

8 0
3 years ago
Read 2 more answers
The instructions in a program, when expressed in Python, ...
sergejj [24]

Answer:

can only be carried out by computers, as long as an interpreter is available which one is it?

Explanation:

The interperetor needed is called CPython, this is the standard C implementation of the language.

7 0
2 years ago
Write a calculator program that will allow only addition, subtraction, multiplication &amp; division. Have the
sveta [45]

num1 = float(input("Enter the first number: "))

num2 = float(input("Enter the second number: "))

operation = input("Which operation are you performing? (a/s/m/d) ")

if operation == "a":

   print("{} + {} = {}".format(num1, num2, num1+num2))

elif operation == "s":

   print("{} - {} = {}".format(num1, num2, num1-num2))

elif operation == "m":

   print("{} * {} = {}".format(num1, num2, num1*num2))

elif operation == "d":

   print("{} / {} = {}".format(num1, num2, num1/num2))

I hope this helps!

5 0
3 years ago
Other questions:
  • Write a converter program for temperatures. This program should prompt the user for a temperature in Celsius. It should then con
    10·1 answer
  • Green field county stadium is planning to conduct a circket match between two teams A and B. A large crowd is expected in the st
    13·1 answer
  • A lottery ticket contains five unique numbers. A set of unique numbers does not contain repeated elements. The winning combinati
    10·1 answer
  • Complete the method, print Multiples(), that takes in a positive integer n, and another positive integer, max. Print out all the
    15·1 answer
  • Match each term in the second column with its correct definition in the first column. Write the letter of the term on the blank
    12·1 answer
  • Question # 1
    12·2 answers
  • A type of authentication that requires the user to provide something that they know, such
    6·1 answer
  • There is a surplus of scientific researchers for a vaccine. This means the demand for this career has
    8·2 answers
  • The hexadecimal eqquivalent of (80)10 is
    11·1 answer
  • How can structure of a table change in sql. What general types of changes are possible
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!