Questions
Write a Visual C# project that will allow the user an option to choose from four...

Write a Visual C# project that will allow the user an option to choose from four different countries. When a country is chosen, the program will display the country flag and information that the user wishes to see. The name of the country selected will be displayed in a label under the country's flag image. The user may also choose to display or hide the form's title, the country name, and the name of the programmer/developer.   Check boxes will be used for the display/hide choices. Radio buttons will be used for the country selection.

You may choose the countries to display and their corresponding flags to display. In the Canvas module, you will see a zip file of flag images or you may choose your own.

Note: see the Note from the previous projects. These are now considered Basic Expectations and are expected in each program you develop and submit for grading.

Additionally, include keyboard access keys for all option buttons, check boxes, and command buttons. (add to Basic Expectations)
Be sure the tab order is set in the most logical order for the user.   (add to Basic Expectations)

In: Computer Science

How can i modify my c code so that each number stored in the array is...

How can i modify my c code so that each number stored in the array is not the array index but the value of the array index converted to radians. I have already made a function for this converion above main().

Below is the code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

float Deg2Rad (float degrees)
{
// Calculate & return value
float Result;
Result = ((M_PI*degrees)/180.0);
return (Result);
}

int main(void)
{
// Declare variables
int Array[90];
int i;

// Loop from 0 to 90 inclusive
for ( i = 0 ; i < 91 ; i++ )
{
Array[i] = i;
printf ("Array number %d contains value %d\n", i, Array[i]);
}

// Exit the application
return 0;
}

In: Computer Science

1. What is the difference between Write and WriteLine in Visual Basic? 2. Can there be...

1. What is the difference between Write and WriteLine in Visual Basic?


2. Can there be more than one variable in a Write or WriteLine? Do they have to be all variables of the same type? Show it by modifying your program. Submit the modified and duly documented program in Visual Basic.


3. Explain the possible assignments of values to numerical variables of different primitive types: integer assigned to integer, integer assigned to real, real assigned to integer and real assigned to real. Which assignments are possible and which give an error in Visual Basic?

In: Computer Science

Question 17 (1 point) What is the return type of this method? public <E extends Comparable<E>>...

Question 17 (1 point)

What is the return type of this method?

public <E extends Comparable<E>> int theMethod(E arg)

Question 17 options:

E

Comparable

int

arg

Question 18 (1 point)

What is the primary benefit of writing generic classes and methods?

Question 18 options:

Generic classes and methods are more type-safe

Generic classes and methods are shorter

Generic classes and methods are faster

Generic classes and methods are backwards compatible

Question 19 (1 point)

What is wrong with the following method?

public static E copy(E arg) {

E theCopy = arg.clone();

return theCopy;

}

Question 19 options:

The method cannot be static if it uses generics

The method calls clone on the argument, but that method is not guaranteed to exist for the argument

You cannot declare a variable (e.g. theCopy) with a generic type

The returned value does not match the method signature

Question 20 (1 point)

Which of these data structures is the best choice in the following situation? You are writing a class scheduling application, and you need to keep track of the wait list for overbooked classes. If a student tries to register for a course that is full, she should be placed at the end of the wait list. If a student drops the course, the student currently at the beginning of the wait list should be moved into the class.

Question 20 options:

list

stack

queue

priority queue

Question 21 (1 point)

Which of these data structures is the best choice in the following situation? You are writing a program to play a card game, and you need to keep track of the discard pile. When a player discards a card, it is placed at the top of the discard pile. If a player wants to pick up a card from the discard pile, she must take the card that is currently on the top.

Question 21 options:

list

stack

queue

priority queue

Question 22 (1 point)

Which of these data structures is the best choice in the following situation? You are writing a program to help the human resource department of a company in scheduling interviews. As applications come in, the hiring manager gives them a score from 0 to 100 according to how well the applicant appears to fit the needs of the position. After a period of two weeks, interviews need to be scheduled. You need a data structure to tell the HR employee which applicant should next be scheduled for an interview. The choice is based on the applicant with the highest score.

Question 22 options:

list

stack

queue

priority queue

Question 23 (1 point)

Which of these data structures is the best choice in the following situation? You are writing a program to track various statistics for the players on the active roster of a baseball team. The order in which the players are stored is not important, but you will frequently need to iterate over all of the players to compute aggregate statistics for the team.

Question 23 options:

list

stack

queue

priority queue

Question 24 (1 point)

What is the output of the following code?

public class Widget implements Cloneable {

public int count;

public FiddlyBit bit;

public Widget() {

bit = new FiddlyBit();

}

public Object clone() throws CloneNotSupportedException {

  return super.clone();

}

public String toString() {

  return "count = " + count + "; bit part number = " + bit.partNo;

}

class FiddlyBit {

  int partNumber;

}

public static void main(String[] args) {

Widget widgetA = new Widget();

widgetA.count = 5;

widgetA.bit.partNo = 111;

Widget widgetB = (Widget) widgetA.clone();

widgetB.count = 6;

widgetB.bit.partNo = 222;

System.out.println("widgetA: " + widgetA);

System.out.println("widgetB: " + widgetB);

}

}

Question 24 options:

widgetA: count = 5; bit part number = 111;
widgetB: count = 6; bit part number = 222;

widgetA: count = 6; bit part number = 222;
widgetB: count = 6; bit part number = 222;

widgetA: count = 6; bit part number = 111;
widgetB: count = 6; bit part number = 222;

widgetA: count = 5; bit part number = 222;
widgetB: count = 6; bit part number = 222;

Question 25 (1 point)

Which of the following is valid, assuming myPetStore is an instance of PetStore? Choose all that apply.

public interface Animal { 
 public abstract void eat();
} 

public class Pet implements Animal { 
 public void eat() { 
  System.out.println("Eating pet food"); 
 }
} 

public class Dog extends Pet { 
}

public class PetStore { 
 public void feedingTime(Animal a) { 
  a.eat(); 
 }
}

Question 25 options:

Animal anAnimal = new Animal();myPetStore(anAnimal);

Pet aPet = new Pet();myPetStore(aPet);

Dog aDog = new Dog();myPetStore(aDog);

None of these are valid

Previous PageNext Page

In: Computer Science

Please read the Specifications carefully. Also do not use any C library. Program Specifications Assuming that...

Please read the Specifications carefully. Also do not use any C library.

Program Specifications

Assuming that all input strings are non-empty (having length of at least 1) and shorter than MAX_LENGTH, implement the following string functions: • strgLen( s ): return the length of string s. • strgCopy( s, d ): copy the content of string s (source) to d (destination). • strgChangeCase( s ): for each character in the string, if it is an alphabet, reverse the case of the character (upper to lower, and lower to upper). Keep the non-alphabet characters as is. • strgDiff( s1, s2 ): compare strings s1 and s2. Return the index where the first difference occurs. Return -1 if the two strings are equal. • strgInterleave( s1, s2, s3 ): copy s1 and s2 to s3, interleaving the characters of s1 and s2. If one string is longer than the other, after interleaving, copy the rest of the longer string to s3. For example, given s1 = “abc” and s2 = “123”, then s3 = “a1b2c3”. If s1 = “abcdef” and s2 = “123”, then s3 = “a1b2c3def”. Notes: • Do not use any C library function at all in your code. Do not add any header file to the code. • The functions (algorithms) must be the most efficient in terms of running time and memory usage. • Submit file strg.c. Complete the header with your student and contact information. Include sufficient comments in your code to facilitate code inspection. • Submit a report in PDF with following information: references (sources); error conditions and actions taken; brief algorithm; running time of the function (algorithm) and a brief explanation. See the template a2report.docx for an example. • See file a2output.txt for sample input and output. • Your code will be graded automatically by a script, so make sure to strictly follow the specifications. • Do not use any output statements (for example, printf) in your code, or they will mess up the grading scripts. • Use the main( ) function provided to test your code. Understanding the code in the main( ) function is part of the assignment. Do not change the code in the main( ) function in the final submission, or your program will mess up the grading script.

/***********************************
* Filename: strg.c 
* Author: Last name, first name
* Email: Your preferred email address
* Login ID: Your EECS login ID
************************************/

#include <stdio.h>
#define MAX_LENGTH 100   // DO NOT CHANGE THIS CONSTANT

/******************  YOUR CODE STARTS HERE ******************/
/************************************************************/

/*
 * Input: non-empty string s
 * Output: return the length of s
 */ 
int strgLen( char s[ ] )
{
   /* ADD YOUR CODE HERE */
  
   return 0;
}


/*
 * Input: non-empty string s
 * Output: copy the content of string s to string dest
 */ 
int strgCopy( char s[ ], char dest[ ] )
{
   /* ADD YOUR CODE HERE */
  
   return 0;
}


/*
 * Input: non-empty string s
 * Output: for each character in string s, if it is an alphabet, reverse the  
 * case of the character.  Keep the non-alphabet characters as is.  
 */ 
int strgChangeCase( char s[ ] )
{
   /* ADD YOUR CODE HERE */
  
   return 0;
}


/*
 * Input: non-empty strings s1 and s2
 * Output: Return the index where the first difference occurs.
 * Return -1 if the two strings are equal.
 */ 
int strgDiff( char s1[ ], char s2[ ] )
{
   /* ADD YOUR CODE HERE */
  
   return 0;
}


/*
 * Input: non-empty strings s1 and s2
 * Output: copy s1 and s2 to s3, interleaving the characters of s1 and s2.  
 * If one string is longer than the other, after interleaving, copy the rest 
 * of the longer string to s3.  
 */
int strgInterleave( char s1[ ], char s2[ ], char d[ ] )
{
   /* ADD YOUR CODE HERE */
  
   return 0;
}

/*******************  YOUR CODE ENDS HERE *******************/
/************************************************************/

/*********  DO NOT CHANGE ANYTHING BELOW THIS LINE IN THE FINAL SUBMISSION *********/

/* main() function 
 */
int main()
{
  char op[ MAX_LENGTH ]; 
  char str1[ MAX_LENGTH ]; 
  char str2[ MAX_LENGTH ];
  char str3[ MAX_LENGTH ];  
  int index;
  
  do {
    scanf( "%s %s", op, str1 );
    switch( op[ 0 ] )
    {
    case 'l':   // length
    case 'L':
      printf( "%d\n", strgLen( str1 ) );
      break;
          
    case 'c':   // copy
    case 'C':
      strgCopy( str1, str2 );
      printf( "%s\n", str2 );
      break;
      
     case 'h':   // cHange case
     case 'H':
      strgChangeCase( str1 );
      printf( "%s\n", str1 );
      break;     
                
    case 'd':  // difference  
    case 'D':
      scanf( "%s", str2 );
      index = strgDiff( str1, str2 );
      if ( index < 0 )
        printf( "Equal strings\n" );
      else
        printf( "%d\n", index );      
      break;    
    
    case 'i':  // interleave
    case 'I':
      scanf( "%s", str2 );    
      strgInterleave( str1, str2, str3 );
      printf( "%s\n", str3 );      
      break;

    case 'q':  // quit
    case 'Q':
      /* To quit, enter character (action) 'q' or 'Q' and an arbitrary string.
         This is not elegant but makes the code simpler.  */  
      /* Do nothing but exit the switch statement */    
      break;
            
    default:  
      printf( "Invalid operation %c\n", op[0] );         
    }  // end switch
  } while ( op[ 0 ] != 'q' && op[ 0 ] != 'Q' );
  
  return 0;
}

In: Computer Science

Consider a router that has the following Routing Table contents: Destination Subnet Outgoing Interface Next Hop...

Consider a router that has the following Routing Table contents:

Destination Subnet

Outgoing Interface

Next Hop

50.62.8.0/24

Fa0/0

118.2.77.4

24.19.0.0/16

Fa0/1

59.16.1.1

0.0.0.0/0

Fa0/2

18.12.52.43

0.0.0.0/0 is the default route. When a packet arrives, the router checks the destination IP address of the packet to see in which subnet it falls. If the destination IP address does not fall within any of the specified subnets, then the default route is used as a last resort. The packet is consequently forwarded out Fa0/2.

  1. A packet with destination IP address 50.62.8.154 arrives to this router. Out what interface will this packet be sent?
  2. A packet with destination IP address 50.62.25.2 arrives to this router. Out what interface will this packet be sent?
  3. A packet with destination IP address 50.61.9.93 arrives to this router. Out what interface will this packet be sent?
  4. A packet with destination IP address 24.19.104.3 arrives to this router. Out what interface will this packet be sent?
  5. A packet with destination IP address 24.18.8.1 arrives to this router. Out what interface will this packet be sent?

In: Computer Science

Hello, I need to divide my code in this different parts. Use a standard approach to...

Hello, I need to divide my code in this different parts.

Use a standard approach to source files in this assignment: a .cpp for each function (you have at least two – main and ageCalc) a header file for the student struct, properly guarded

Code:

#include <iostream>

#include <string>

#include <fstream>

#include <algorithm>

#include <vector>

#include <iomanip>

using namespace std;

#define nullptr NULL

#define MAX_SIZE 100

struct Student

{

    string firstName;

    char middleName;

    string lastName;

    char collegeCode;

    int locCode;

    int seqCode;

    int age;

};

struct sort_by_age

{

    inline bool operator()(const Student *s1, const Student *s2)

    {

        return (s1->age < s2->age);

    }

};

int ageCalc(Student *studs[], Student *&youngest);

int main()

{

    Student *students[MAX_SIZE] = {nullptr};

    ifstream Myfile;

    Myfile.open("a2data.txt");

    if (!Myfile.is_open())

    {

        cout << "Could not open the file!";

        return 1;

    }

    vector<string> words;

    string line;

    while (!Myfile.eof())

    {

        getline(Myfile, line);

        line.c_str();

        int i = 0;

        string word = "";

        while (line[i] != '\0')

        {

            if (line[i] != ' ')

            {

                word = word + line[i];

                i++;

            }

            else

            {

                if (word != "")

                    words.push_back(word);

                word = "";

                i++;

            }

        }

        words.push_back(word);

    }

    Myfile.close();

    int count = 0;

    string fname = words.at(count);

    count++;

    int n = 0;

    while (count < words.size() - 2)

    {

        Student *s = new Student;

        s->firstName = fname;

        string mname = words.at(count);

        s->middleName = mname[0];

        count++;

        s->lastName = words.at(count);

        if (words.at(count).size() >= 12)

        {

            if (words.at(count)[1] >= '0' && words.at(count)[1] <= '9')

            {

                count--;

                s->middleName = ' ';

                s->lastName = words.at(count);

            }

        }

        count++;

        string id = words.at(count);

        count++;

        s->collegeCode = id[0];

        string loc = "";

        loc = loc + id[1];

        loc = loc + id[2];

        s->locCode = stoi(loc);

        string seq = "";

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

        {

            seq = seq + id[j];

        }

        s->seqCode = stoi(seq);

        string age = "";

        age = age + id[9];

        age = age + id[10];

        age = age + id[11];

        s->age = stoi(age);

        fname = id.erase(0, 12);

        students[n] = s;

        n++;

    }

    words.clear();

    sort(students, students + n, sort_by_age());

    cout << setw(15) << left << "Last Name";

    cout << setw(15) << left << "Midlle Name";

    cout << setw(15) << left << "First Name";

    cout << setw(15) << left << "College Code";

    cout << setw(12) << left << "Location";

    cout << setw(12) << left << "Sequence";

    cout << setw(12) << left << "Age" << endl;

    cout << "=======================================================================================" << endl;

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

    {

        cout << setw(15) << left << students[i]->lastName;

        cout << setw(15) << left << students[i]->middleName;

        cout << setw(20) << left << students[i]->firstName;

        cout << setw(13) << left << students[i]->collegeCode;

        cout << setw(10) << left << students[i]->locCode;

        cout << setw(12) << left << students[i]->seqCode;

        cout << students[i]->age << endl;

    }

    cout << endl;

    Student *youngest = NULL;

    int avg_age = ageCalc(students, youngest);

    cout << "Average age is: " << avg_age << endl;

    cout << "Youngest student is " << youngest->firstName << " " << youngest->middleName << " " << youngest->lastName << endl;

    return 0;

}

int ageCalc(Student *studs[], Student *&youngest)

{

    youngest = studs[0];

    int i = 0;

    int avg_age = 0;

    while (studs[i] != NULL)

    {

        avg_age += studs[i]->age;

        if (youngest->age > studs[i]->age)

            youngest = studs[i];

        i++;

    }

    return avg_age / i;

}

File needed:

https://drive.google.com/file/d/15_CxuGnFdnyIj6zhSC11oSgKEYrosHck/view?usp=sharing

In: Computer Science

Describe the matrices and formulae used to determine centralization or distribution of data. In the absence...

Describe the matrices and formulae used to determine centralization or distribution of data. In the absence of subjective reasoning, would the matrices and formulae lead to a rational decision? Why or why not?

Develop all of the distribution matrices and subjective reasoning for/against distribution, for the problem chosen in Unit 3 (from Appendix). Develop recommendations and explain your reasoning for each choice

In: Computer Science

Make a python code. Write a function named max that accepts two integer values as arguments...

Make a python code.

Write a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two. Write the program as a loop that continues to prompt for two numbers, outputs the maximum, and then goes back and prompts again

Here’s an example of program use

Input the first number: 10

Input the second number: 5

The maximum value is 10

Run again? yes

Input the first number: -10

Input the second number: -5

The maximum value is -5

Run again? no

Function max():

Obtain two numbers as input parameters: max(num1, num2):

if num1 > num2 max_val = num1, else max_val = num2

return max_val

Main Program:

Initialize loop control variable (continue = ‘y’)

While continue == ‘y’

Prompt for first number

Prompt for second number

Call function “max,” sending it the values of the two numbers, capture result in an assignment statement:

max_value = max (n1, n2)

Display the maximum value returned by the function

print(‘Max =’, max_val)

Ask user for if she/he wants to continue (continue = input(‘Go again? y if yes’)

In: Computer Science

IST 411 What are the advantages of using CURL for handling webbot automation? What are some...

IST 411

  1. What are the advantages of using CURL for handling webbot automation?
  2. What are some of the disadvantages in creating a webot to perform content gathering?
  3. What networking protocols are supported with CURL?
  4. What is pycurl and what can you do with pycurl?
  5. Write a pycurl example that grabs some Web page HTML content.

In: Computer Science

Write a function flipSwitches that accepts one argument, a sequence of upper or lower case letters...

  1. Write a function flipSwitches that accepts one argument, a sequence of upper or lower case letters (the sequence can either be a str or a list, if you write your code correctly, it shouldn’t matter). This is a sequence of switches, uppercase means to turn a switch on, and lowercase to turn a switch off.   For example, ‘A’ means to turn the switch ‘A’ on, and ‘a’ means to turn the switch ‘A’ off.   (Turning an on switch on again, or an off switch off again, has no effect).   The function should then return the set of those switches that are still on at the end of the sequence of switches.   For example, the expression flipSwitches( ['A','A','a','B'] ) returns the set {'B'} because, the switch ‘B’ is turned on during the sequence, whereas the switch ‘A’ is turned on twice (so still on), then turned off once, so it is off at the end.   To receive full credit, your code must use a set that keeps track of the switches that are on. You can then iterate over the sequence and modify the set of switches that are on as appropriate. Sample output:


>>> flipSwitches( ['A','A','a','B'] )

{'B'}

>>> flipSwitches( 'ABCba')

{'C'}

>>> flipSwitches( 'sdfjSDSDFasjjfdjldsSDF' )=={'S', 'D', 'F'}

True

use python 3.7

In: Computer Science

Q1) What is the difference between IP address and MAC address for a computer? (4 marks)...

Q1) What is the difference between IP address and MAC address for a computer?

Q2) What is the difference between Internet (with I capital letter) and internet (with i small letter)?

Q3) What is the difference between network and internet in general?

In: Computer Science

Given the code segment: def f1(a, b = 2): if a : print(1) f1(1) what is...

Given the code segment:

def f1(a, b = 2):

if a :

print(1)

f1(1)

what is the result of executing the code segment?

a) Syntax error

b) Runtime error

c) No error

d) Logic error

in which scenario(s) is using a dictionary useful?

a) To store the dates of lesson that each student is absent for so that warning letters may be issued to student exceeding a limit.

b) To store the student numbers for students who sat for an exam

c) To retrieve email of students who are absent for an exam. The student numbers will be entered into the recipient field and the system should display the student email.

d) The marks should be entered into the exam system. The exam system displays rows of student number, and the marks can be entered against the student number. The grade will be computed and reflected in the student row .

which expression returns True when a number, x is not and odd number between 1 (inclusive) and 100 (inclusive), and returns False otherwise?

a) x not in range(100) and x % 2 !=0

b) x not in range(1,101) and x % 2 !=0

c) not( x in range(1,101) and x % 2 1=0

d) x not in range(1,101) or x % 2 !=0

In: Computer Science

Hi, i'm creating a c++ program with a linked list of Employees, i'm running into issues...

Hi, i'm creating a c++ program with a linked list of Employees, i'm running into issues as far as displaying programmers only portion and the average salary of all the employees. Please make any changes or comments !

Employee.h file:

#ifndef EMPLOYEE_H

#define EMPLOYEE_H

#include

using namespace std;

enum Role {programmer, manager, director};

struct Employee

{

std::string firstName;

std::string lastName;

int SSN;

std::string department;

double salary;

Role role;

};

#endif

#ifndef NODE_H

#define NODE_H

Node.h file:

#include "Employee.h"

typedef Employee EMP;

struct Node

{

EMP e;

Node * next;

Node();

Node(EMP);

Node(EMP,Node* next);

};

Node::Node()

{

next=NULL;

}

Node::Node(EMP e_data)

{

e=e_data;

}

Node::Node(EMP e_data, Node* next)

{

e=e_data;

this->next= next;

}

#endif

Main cpp file:

#include <iostream>

#include <cstdlib>

#include <ctime>

#include "Employee.h"

#include "Node.h"

using namespace std;

void setSalary (Employee& emp)

{

emp.salary= 45000+rand() %20000; // generates salary for employee

}

void setRoles(Employee& emp)

{

emp.role = static_cast(rand()%3); // gives employee job title

}

void setSSN (Employee& emp)

{

// int y = x;

emp.SSN =rand()%499999999+400000000; // sets employee SSN

}

void setFirst( Employee& emp, string* name)

{

int y = rand()%5;

emp.firstName = name[y]; //gives random first name

}

void setLast(Employee& emp, string* name)

{

int y = rand()%5;

emp.lastName = name[y]; // gives random last name

}

void setDepartment(Employee& emp, string * dep)

{

int y = rand()%3;

emp.department= dep[y]; //gives employee random department

}

int main()

{

srand(time(NULL)); // random number generator

double avgSalary; // initialize Average Salary

Node* head= NULL; // starting node

Node* prev= NULL; // node next to the last one

Employee e; // object instance

// array of names, roles(job titles), and departments

string roleType [3] = {"programmer", "manager", "director"};

string firstName[5] = {"John", "James", "Joe", "Jessica", "Juno" };

string lastName[5] = {"Smith", "Williams", "Jackson", "Jones", "Johnson" };

string department[5]= {"Accounting", "IT", "Sales" };

// Create linked list of employees

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

{

Employee e;

// function calls (roles, salary ...etc)

setFirst(e, firstName);

setLast(e, lastName);

setSSN(e);

setSalary(e);

setRoles(e);

setDepartment(e, department);

// creates nodes for employees

Node*temp = new Node(e);

if (i ==0)

{

head=temp;

prev= temp;

}

else

{

prev->next= temp;

prev = temp; // links the nodes together

}

}

// Display information of all Employees

cout<<"======== Employee Data======="<

prev = head; // starting at the first node

while(prev !=NULL)

{

cout<<(prev->e).firstName<< " ";

cout<<(prev->e).lastName<< " ";

cout<<(prev->e).SSN<< " ";

cout<<(prev->e).salary<< " ";

cout<<(prev->e).department<< " ";

cout

prev= prev->next;

}

cout<<" \n \n";

//

cout<<"======== Programmer Only Data======="<

prev = head; // starts at beginning of linked list

while(prev !=NULL)

{

if (prev->e.role == 0) // checks to see if role is 0 or programmer

cout<<(prev->e).firstName<< " ";

cout<<(prev->e).lastName<< " ";

cout<<(prev->e).SSN<< " ";

cout<<(prev->e).salary<< " ";

cout<<(prev->e).department<< " ";

cout

prev= prev->next; // moves on to next node

// else {

// break;

// }

}

//Computes Average Salary

prev = head; // starts at the first node

while ( prev !=NULL)

{

avgSalary += (prev->e).salary;

prev = prev->next;

}

// Display Average Salary

cout<< "Average Salary: "<< (avgSalary)/5 << "\n";

// Deallocate memory

Node* temp = head;

Node* tail;

while (temp !=NULL)

{

tail=temp->next;

delete temp;

temp = tail;

}

head=NULL;

if (head == NULL )

{

cout<<" List Deleted \n";

}

}

In: Computer Science

Does anyone know how to sort these in C++: n-Butane C4H10 Propyne C3H3 1,3-Butadiyne C4H2 Hexane...

Does anyone know how to sort these in C++:

n-Butane C4H10
Propyne C3H3
1,3-Butadiyne C4H2
Hexane C6H14
Butane C4H10
iso-Butane C4H10
Pentane C5H12

By using this guideline:
Each molecular formula will be kept in a struct with three fields:

-the name(s) for formula. Note that is a collection of names
-the number of carbon atoms
-the number of hydrogen atoms
We will be storing all these structs in a vector.


The output must be this:
C3H3 Propyne
C4H2 1,3-Butadiyne
C4H10 n-Butane Butane iso-Butane
C5H12 Pentane
C6H14 Hexane

In: Computer Science