C++
What is the below code attempting to do (continuing from previous part)? What is wrong with this ...
What is wrong with the following code? This piece of code incorrectly attempts to remove all even values from a stack integers. How would you fix it? You will need to write a class with the main(String[] args) {….} method to test the following piece of code, find the problem, and fix it. while (!s1.isEmpty()){ int n = s1.pop(); if (n % 2 != 0) { s1.push(n); // if odd put it back. } }
Have you ever noticed the bar code printed on envelopes? That
code helps the USPS process the mail. The barcode is generated as
specified below.
In this assignment you are to write a JAVA
program that will accept a 5 digit number from the user and then
prints the appropriate symbols to the screen. Name your file
ZipCode_yourInitials.java. The specifications for the code
are PostalCodeAsignment.pdf. Using a
do while loop allow the user to continue entering
numbers as long as...
// Code is buggy. Fix bugs. Do NOT re-write the whole code! #include <iostream> using namespace std; class LinkedList; class Node { private: string data; Node* next; public: Node(string s, Node* n); string getData() {return data;} Node* getNext() {return next;} } Node::Node(string s, Node* n) { data = s; next = n; } class LinkedList { private: Node* head; public: LinkedList(); bool insert(string s); friend ostream& operator<<(ostream& os, LinkedList l); }; LinkedList::LinkedList() : head(nullptr) { } bool LinkedList::insert(string s) {...
BELOW IS THE CODE I ALREADY HAVE
Linked List - Delete Modify Lab 5 and include the method to delete a node from the Linked List. In summary: 1) Add the method Delete 2) Method call to delete, with a number that IS in the list 3) Method call to delete, with a number that is NOT in the list - Be sure to include comments - Use meaningful identifier names (constants where appropriate) import java.io.*; 1/ Java program to...
can someone please double check my code here are the requirements please help me fulfill the requirements Using the material in the textbook (NumberList) as a sample, design your own dynamic linked list class (using pointers) to hold a series of capital letters. The class should have the following member functions: append, insert (at a specific position, return -1 if that position doesn't exist), delete (at a specific position, return -1 if that position doesn't exist), print, reverse (which rearranges...
Why is part 2 wrong, and what would be the correct
organic product? :)
Be sure to answer all parts. Suggest a reasonable mechanism for the following reaction. (Show lone pairs for non- carbon atoms.) Part 1: =CH2 + Br-Br: : Br: view structure view structure organic inorganic We were unable to transcribe this image
What is wrong with the following code? How would you fix it? (Assume all the appropriate import statements) /* print every other element in a linkedlist */ LinkedList<String> exampleLL = new LinkedList<String>(); exampleLL.add("Today"); exampleLL.add("is"); exampleLL.add("a"); exampleLL.add("sunny"); exampleLL.add("day"); exampleLL.add("outside"); exampleLL.add("I"); exampleLL.add("Like"); exampleLL.add("summer"); exampleLL.add("and"); exampleLL.add("the"); exampleLL.add("sunshine"); exampleLL.add("it"); exampleLL.add("brings"); exampleLL.add("too;"); /* etc etc etc */ ListIterator iter = exampleLL.ListIterator(); System.out.println("Every other word of the speach:") while (iter.hasNext()) { System.out.println(iter.next().next()); }
What is wrong with the following program? Explain how you will fix it in the code. #include int main() { int i; int *ptr = &i; scanf("%d", &ptr); printf("The value of i is: %d\n", *ptr); return 0; }
Modify the below code to fit the above requirements:
struct node
{
char data;
struct node *next;
struct node *previous;
} *front, *MyNode, *rear, *MyPointer, *anchor *Valuenode ;
typedef struct node node;
int Push(char input)
{
if(IsFull()==1)
{
printf("The queue is full. Enter the ‘^’ character to
stop.\n");
return -1;
}
else if (IsFull()==-1)
{
node *MyNode=(node*)malloc(sizeof(node));
MyNode->data=input;
rear->next=MyNode;
MyNode->previous=rear;
MyPointer=rear=MyNode;
return 1;
}
else
{
node *MyNode=(node*)malloc(sizeof(node));
node *anchor=(node*)malloc(sizeof(node));
MyNode->data=input;
MyPointer=rear=front=MyNode;
MyNode->previous=NULL;
MyNode->next=NULL;
anchor->next=MyNode;
return 0;
}
}
char...
program in C - Starter code below //In this assignment, we practice call by reference. //Below description of call by reference is from the following link //https://www.tutorialspoint.com/cprogramming/c_function_call_by_reference.htm //The call by reference method of passing arguments to a function copies //the address of an argument into the formal parameter. Inside the function, //the address is used to access the actual argument used in the call. //It means the changes made to the parameter affect the passed argument. //We use an example...