Hi so we have 4 labs in our introduction to c++ class for this week and this is the only exercise that I couldn't understand thank you guys
//Lab exercise 4: //Ask the user to input 10 probabilities (numbers between 0 and 1).
Then output the index(es) of the number(s) with highest probability. //Example input: 0.8 0.8 0.8 1 1 1 1 1 0.8 0.8 //Example output: 3 4 5 6 7
#include<iostream> using namespace std; int main() { int i; float array[10],max=0; cout<<"Enter The Probabilities(0 to 1)"<<endl; //taking input from user for(i=0;i<10;i++) { cin>>array[i]; if(!(array[i]>=0 && array[i]<=1)) //condition checking for whether entered value is in between 0 to 1 { cout<<"Invalid value......please enter values between 0 to 1"<<endl; // if not in between 0 to 1 then return will terminate the program; return 0; } if(max<array[i]) { max=array[i]; //storing maximum value in max variable; } } cout<<"Index values of The Array where Maximum value present"<<endl; for(i=0;i<10;i++) { if(max==array[i]) //searching for index value which contains max value; { cout<<i<< " "; } } return 0; }
output
Hi so we have 4 labs in our introduction to c++ class for this week and...
hi, I'm a new student of c++, I found it's difficult to understand the class, can you guys please give me an example of how to create a two dimensional array in a class. like create an array[3][4] in a class, let the user input the value of array. Thank you.
Please post the code in c++!
Computer Labs Write a Computer Labs program to store the list of user IDs for each computer station using a linked list. Problem Description: You run four computer labs. Each lab contains computer stations that are numbered as shown in the table below: Lab Number Computer station Numbers 1-5 2 1-6 1-4 4 1-3 Each user has a unique five-digit ID number. Whenever a user logs on, the User's ID, labnumber, and the computer...
Write the following program in C++ You run four computer labs, Each lab contains computer stations that are numbered as shown in the table below: Lab Number Computer Station Numbers 1 1 - 5 2 1 - 6 3 1 - 4 4 1 - 3 Each user has a unique five-digit ID number. Whenever a user logs on, the user’s ID, lab number, and the computer station number are transmitted to your system. For example, if user 49193 logs...
Java Computer Labs Assignment! The code NEEDS to be commented properly! Every class file should have a header comment that includes your name and assignment number and briefly documents what the program does! If there are known deficiencies with your program such as known problems or incomplete features, these should be clearly listed in the header comment! Every method should have a method header comment that documents what the method does, what its parameters are, and what it returns! You...
Hi guys just starting out programming and my professor doesn't really explain it that much can you help me with this lab of mine in c++ and yes I'll give you points for it thank you! Lab #1 /Part A: //Input number 1 (store in var1) //Input number 2 (store in var2) //Swap them, so number 1 is in var2 and number 2 is in var1 //Output the numbers to stdout (cout) //Multiply var1 by 2 //Divide var2 by 2...
Labs CSIT 210 Introduction to Programming LAB 9B Arrays Change the program AirlineDriver.java to assign passenger seats in an airplane. Chesapeake Airlines is a small commuter airline with seats for 20 passengers in 5 rows of 4 seats each. Here is the layout: 1ABCD 2ABCD 3ABCD 4ABCD 5ABCD The user enters the row (1 – 5) and the seat (A – D). The seat entry may be lowercase. Use this code to enter the seat: System.out.print(" Enter row and seat...
Hi, this is an intro to C Programming Class. Please do not use
arrays, functions, math.h, or struct to store any data except to
declare strings char strVar[20].
Furthermore, can you please do a good check to make sure the
final program does not have any problems because when I copy and
paste them the app I use says there are some problems and it won't
run the program. So if you can double check to make sure that
everything...
PYTHON
4. While Loops (25%) You will be writing a "shell" application, it will be on a loop, taking in commands from the user. The command syntax is as follows command> <arga» <arg1> arg n> The commands you are to implement: Command Description Prints all arguments on the same line, with a space between each. Treats all arguments as floating-point numbers, and prints the average. MUST print an error if given invalid arguments Finds the index of arg1 in arg0....
Hi Guys,
Just wondering if someone could help me with the below,
specifically detailed so that I can understand in the future.
Thanks in advance!
he Factor Finder takes a 4 bit binary number entered by the user (representing the values 0 to 15) and tells the user if the number is zero, odd, even or a multiple of 3, 4, or 5 The input and output details are as follows: Digital Inputs: I1: Bit O of the four digit...
JAVA Programming Assignment: You run four computer labs. Each lab contains computer stations that are numbered as shown in the table below:- Lab Number Computer Station Numbers 1 1-5 2 1-6 3 1-4 4 1-3 Each user has a unique five-digit ID Number. Whenever a user logs on, the user's ID, Lab Number, and the computer station are transmitted to your station. For example, if user 49193 logs onto station 2 in Lab 3, your system receives (49193, 2, 3)...