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
jok3333 [9.3K]
3 years ago
10

int sequence[10] = { 3, 4, 5, 6, 7, 8, 9, 10, 1, 2 }; Write a C++ program to ask the user to enter a number, if the number can b

e found in the array, your program should display "Found". Otherwise, your program should display "Not found". For example, if the user enters 7, your program should display "Found". If the user enters 11, your program should display "Not found".
Computers and Technology
1 answer:
Inessa [10]3 years ago
7 0

Answer:

The c++ program to implement search through an array is shown.

#include <iostream>

using namespace std;  

int main()  

{

   int sequence[10] = { 3, 4, 5, 6, 7, 8, 9, 10, 1, 2 };

   int input;

   int found = 0;

   cout << " This program confirms whether your element is present in the array. " << endl;

   cout << " Enter any number  " << endl;

   cin >> input;

   for( int k = 0; k < 10; k++ )

   {

       if( input == sequence[k] )

           found = found + 1;

   }

   if( found == 0 )

       cout << " Not Found " << endl;

   else

       cout << " Found " << endl;

   return 0;

}

OUTPUT

This program confirms whether your element is present in the array.  

Enter any number  

7

Found

Explanation:

The program uses the given integer array.

User is prompted to input any number. No validation is implemented for user input since it is not mentioned. The user input is taken in an integer variable, input.

int input;

cout << " Enter any number " << endl;

   cin >> input;

Another integer variable found is declared and initialized to 0.

int found = 0;

Inside for loop, each element is compared with the user input.

If the user input is present in the given array, variable found is incremented by 1.

for( int k = 0; k < 10; k++ )

   {

       if( input == sequence[k] )

           found = found + 1;

   }

If value of variable found is 0, program displays “ Not Found ”.

If the value of variable found is greater than 0, program displays “ Found ”.

if( found == 0 )

       cout << " Not Found " << endl;

   else

       cout << " Found " << endl;

This program can be tested for both positive and negative numbers.

You might be interested in
HELP PLS QUICK TRUE OR FALSE QUESTION
dmitriy555 [2]

Answer: I think the answer is true but I don't fully understand it sorry if im wrong.

Explanation:

8 0
3 years ago
Read 2 more answers
Which US electronics company was the pioneer in home video game consoles
drek231 [11]

This is a list of home video game consoles in chronological order, which includes the very first home video game consoles ever created, such as first generation Pong consoles, from the first ever cartridge console Odyssey, ranging from the major video game companies such as Magnavox, Atari, Nintendo, Sega, NEC, 3DO, SNK, Sony, Microsoft to secondary market consoles.


The list is divided into eras which are named based on the dominant console type of the era, though not all consoles of those eras are of the same type. Some eras are referred to based on how many bits a major console could process. The "128-bit era" (sixth generation) was the final era in which this practice was widespread.[citation needed]


This list does not include other types of video game consoles such as handheld game consoles, which are usually of lower computational power than home consoles due to their smaller size, microconsoles, which are usually low-cost Android-based devices that rely on downloading, or dedicated consoles which have games built in and do not use any form of physical media. Consoles have been redesigned from time to time to improve their market appeal. Redesigned models are not listed on their own.

7 0
3 years ago
Vlad is the leader of a group; he receives most of the messages from the group members, and he provides most of the information
LekaFEV [45]

Answer:

<u><em>Wheel </em></u>network

Explanation:

A wheel network <em>is a communication style in which the leader is the only one to receive or communicate.</em>

The leader, generally the business's manager or owner, is like the bright light in the middle of a Ferris wheel; the light starts in the middle and then passes on to all the spokes at the wheel's ends.

The one individual needs to understand everything about the company and to deliver all communications. Staff have a clear idea of how to make decisions and how to manage interaction.

6 0
3 years ago
Determine which careers you can enter after completing a training program and which careers require a college degree.
KonstantinChe [14]

Answer: statistician automotive engineer customer service specialist data modeler broadcast technician video systems technician

Explanation:

8 0
3 years ago
Which of these statements regarding mobile games is true?
SashulF [63]

Answer:

A. They are typically played in doors.

Explanation:

Most logical answer

8 0
3 years ago
Read 2 more answers
Other questions:
  • All of the following are qualities of an aprenticeship except
    12·1 answer
  • Which of the following is a sigh that your computer may have been infected with malicious code
    12·1 answer
  • Illustrate the process of using an operating system to manipulate a computer’s desktop, files and disks.
    12·1 answer
  • When using the boolean data type, we encapsulate the data in what symbol?
    11·2 answers
  • Given an integer n and an array a of length n, your task is to apply the following mutation to an: Array a mutates into a new ar
    5·1 answer
  • The area surrounding your car that can't be seen from the driver's seat is called
    14·2 answers
  • Some applications required advanced storage solutions are available to provide fault tolerance and high performance.
    13·1 answer
  • Which wireless standard uses the 2.4 GHz frequency band only?
    5·1 answer
  • When right-clicking an object, a ____ menu appears, which contains frequently used commands related to the object.
    7·1 answer
  • A packet switch has 5 users, each offering packets at a rate of 10 packets per second. The average length of the packets is 1,02
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!