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
PIT_PIT [208]
2 years ago
13

Does anyone know how to write this right? This is for a coding class and I’m super confused on it.

Computers and Technology
1 answer:
vovangra [49]2 years ago
4 0

Answer:

This is using c++ syntax, you might need to make slight adjustment for other languages.

First activity:

string firstSnack = "chips";

string secondSnack = "pizza";

string thirdSnack = "apples";

string bestSnack =  firstSnack;

bestSnack = secondSnack;

Second activity:

double apple = 0.5;

double banana = 0.75;

double orange = 1.43;

double total = apple + banana + orange;

Explanation:

When first declaring a variable, you want to specify the type (such as int, double, string, bool, etc.) and then the name. You can set the variable value in the declaration, or you can set it to a value later in the program by not having the equals sign and whatever comes next.

You might be interested in
Create a lottery game application. Generate three random numbers (see Appendix D for help in doing so), each between 0 and 9. Al
Pachacha [2.7K]

The question is not complete! Here is the complete question and its answer!

Create a lottery game application. Generate three random numbers (see Appendix D for help in doing so), each between 0 and 9. Allow the user to guess three numbers. Compare each of the user’s guesses to the three random numbers and display a message that includes the user’s guess, the randomly determined three-digit number, and the amount of money the user has won as follows:

no matches: 0

any one matching: 10$  

two matching: 1000$  

three matching: 100000$  

Code with Explanation:

#include <iostream>

using namespace std;

int main()

{

int matches=0;

int guess_1, guess_2, guess_3;

int num_1, num_2, num_3;

// get 3 digits from the user

cout<<"Enter first guess digit 0 to 9"<<endl;

cin>>guess_1;

cout<<"Enter second guess digit 0 to 9"<<endl;

cin>>guess_2;

cout<<"Enter third guess digit 0 to 9"<<endl;

cin>>guess_3;

// every time program runs srand() generates new random numbers and rand()%10 makes sure that number is single digit 0 to 9

srand(time(NULL));

num_1=rand()%10;

cout<<"First lottery digit: "<<num_1<<endl;

num_2=rand()%10;

cout<<"Second lottery digit: "<<num_2<<endl;

num_3=rand()%10;

cout<<"Third lottery digit: "<<num_3<<endl;

// store random generated numbers and guess numbers in arrays to compare them

int num[3]= {num_1,num_2,num_3};

int guess[3]={guess_1,guess_2,guess_3};

// compare the arrays to find out how many are matching

   for(int i=0; i<3; i++)

   {

 for(int j=0; j<3; j++)

 {

  if(num[i]==guess[j])

  {    

   matches = matches + 1;

  }

 }

}

cout << "Total Matches are: " <<matches << endl;

// display reward according to the number of matches

if (matches==0)

cout<<"you won: $0"<<endl;

if (matches==1)

cout<<"you won: $10"<<endl;

if (matches==2)

cout<<"you won: $1000"<<endl;

if (matches==3)

cout<<"you won: $100000"<<endl;

return 0;

}

Output:

Enter first guess digit 0 to 9

7

Enter second guess digit 0 to 9

1

Enter third guess digit 0 to 9

5

First lottery digit: 3

Second lottery digit: 7

Third lottery digit: 2

Total Matches are: 1

You won: $10

Enter first guess digit 0 to 9

7

Enter second guess digit 0 to 9

3

Enter third guess digit 0 to 9

4

First lottery digit: 5

Second lottery digit: 4

Third lottery digit: 7

Total Matches are: 2

You won: $1000

5 0
4 years ago
What is the maximum number of characters you can have in a file name​
Leokris [45]

Answer:

255 number of characters including space, \ etc.

5 0
3 years ago
List and describe two of the four generally recognized security positions.
Llana [10]
CISO: This person reports directly to the CIO and is responsible for assessing, managing, and implementing security.
Security Technician: Entry-level position and provides technical support to conFgure security hardware, implement security software, and diagnose and troubleshoot <span>problems</span>
8 0
4 years ago
Some web and mobile applications allow users to share pictures and videos, as well as chat and message. True False
pishuonlain [190]
True ever heard of Instagram or snap chat
8 0
3 years ago
Read 2 more answers
Fill in the blanks to help write this professional e-mail:
a_sh-v [17]

The Fill in the blanks of this professional e-mail is given below:

<h3>What is the email about?</h3>

The Team Lead,

Dangete group.

To Design Team,

<h3>                     Email on project presentation</h3>

You may have heard, I am meeting with the VP (Vice-President) of Finance to highlight our team’s work on the Big Project. There we are going to talk about all the work that the team members can do and have done.

I’d like to show our best work to the VP, which is why I am asking for your help now. I want to have a slideshow of our best designs to present.

This will be presented when he comes to visit and as such, Please send me final versions of your best work so I can create the presentation. I trust you all and i know you are have been giving your best for the company's growth.

Thanks for your support.

Yours faithfully,

Jan Gith,

Team Lead

Learn more about  Design Team from

brainly.com/question/25886641

#SPJ1

7 0
2 years ago
Other questions:
  • What term is used to describe a function that uses an algorithm to convert an input of letters and numbers into an encrypted out
    9·1 answer
  • A list of the available non keyboard characters can be seen in windows by opening what utility
    7·1 answer
  • It will gain you more knowledge, intensify your soft skills, strong work ethics and grow your network. What is it?​
    12·2 answers
  • What is the benefit to displaying the merge codes in a document?
    9·1 answer
  • Write the code that creates a public class named Vehicle that has one private data member. The private data member is an integer
    13·1 answer
  • Assume that input file references a Scanner object that was used to open a file. Which of the following while loops shows the co
    6·1 answer
  • Following the car in front of you at a closer distance _____.
    6·2 answers
  • When you are working in Performance Monitor, in the "Add Counters" dialog box, and need more information about a particular coun
    8·1 answer
  • What kind of block do you need to check whether a sprite is touching another sprite?
    10·1 answer
  • __________ are very simple devices that connect network components, sending a packet of data to all other connected devices.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!