Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

problem1)
a) Convert the expression 4-5/6+(2/3-8)}/8*3 to RPN.

b) What is the output of the following program? describe step by step the procedure.
#include

int
main()
{
Int row=5,column;
while(row>=1)
{
column=1;
while(column<=5)
{
printf("%s",row%2 ? "<" : ">");
++column;
} --row;
printf("\n");}
return0;}

Instead of using nested while loops, if you want to use nested for loops, what changes are required in the above program so that the output remains same ?

c) prepare a program using switch statement which takes two integers and an operator from the keyboard. If the operator entered through the keyboard is any one of the operators { + ,-, * ,/ }, then the program performs the operation and print the result. If the operator entered is other than the mentioned above, the program prints the string “Operation cannot be performed”. Your program should also take care of the division by 0.

problem4) Assume the following declarations

Int a[5] ={1,2,3,4,5};
Int *ptr_a,*ptr=NULL;
Int number ,i;
ptr_a=&a;

Find errors in the following statements if any and do the necessary corrections.

i) ++ptr_a;

ii) number=ptr_a;

iii) number=*ptr_a[2];

iv) for(i=0;i<=5;i++)
printf("%d",ptr_a[i]);

v) number=*ptr;

c) Define a function isprime ( ) which takes a positive integer and returns 1 if the number is prime and 0 otherwise. Use this function to define another function called num_of_primes ( ) which takes  two natural numbers p and q(where p < q) and returns the number of primes between them.

d) Define a macro to find the minimum of two numbers. Using this define a function minimum ( ) which takes four numbers as parameters and returns the minimum.

e) Arrange the following operators in ascending order of priority. Tell associativity for the operators who have same priority.

                     <   *   >  ||  []   +=  !=     +      ++

problem5) a) prepare a function with the following prototype int delete_elements (int *list[ ], int last_index, int p, int q) which deletes all the elements of a list from index p to q (where p < q ) and returns the last_index of the updated list . Also prepare the main function to test your function.

b) prepare statements to accomplish each of the following. Assume the structure

struct person

{

char lastName[10];

char firstName[10];

int Age;

};

has been defined and that the file is already open for writing.

i) Initialize the file “personaldata.dat” so that there are 100 records with lastName=“ ”, firstName =“ ” and Age = 0.

ii) Input 10 last names, first names and ages and prepare them to the file.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92586
  • Price:- $60

Priced at Now at $60, Verified Solution

Have any Question? 


Related Questions in C/C++

Writeacprogramthatwilluseloopstoperformeachofthefollowingtas

Write a C++ program that will use loops to perform each of the following tasks: 1. Ask the user for two characters from the keyboard and read them into char variables. Determine which input is larger and which is smaller ...

1 learner objectivesat the conclusion of this programming

1. Learner Objectives: At the conclusion of this programming assignment, participants should be able to: * Apply repetition structures within an algorithm * Construct while (), for (), or do-while () loops in C * Compose ...

Descriptionnbspin this assignment you will write a c

Description:  In this assignment you will write a C++ program that finds the kth largest number among a set of N numbers. It will implement the solution using two different algorithms and measure the time elapsed during ...

Computer programmingobjectives1 opening a file reading from

Computer Programming Objectives: 1. Opening a file, reading from file, writing to a file and closing a file. 2. Sequential access files handling. 3. Practice C++ programming problems. Note: Carefully read the following i ...

For this program you will add and test 2 new member

For this program you will add and test 2 new member functions to the IntSLList class posted on the website. The two member functions are: insertByPosn(int el, intpos) Assuming that the positions of elements of a list beg ...

This program involves using stl listsfor this program you

This program involves using STL lists. For this program you will implement three functions whose prototypes are given below: list ::iterator mxIter(list ::iterator first, list ::iterator last); void selectSort(list & aLi ...

Question 1you are facing the following problem you are

Question 1 You are facing the following problem: You are given a robot and your task is to "guide" the robot through a 2-dimensional maze such that the robot can reach a desired goal state. Assume that the maze is define ...

Object oriented programmingassignmentq1 assuming there are

Object Oriented Programming Assignment Q1: Assuming there are 7.481 gallons in a cubic foot, write a program that asks the user to enter a number of gallons, and then displays the equivalent in cubic feet. Q2: You can co ...

Problem 1overview for problem 1a of this assignment you

Problem #1 Overview: For problem 1(a) of this assignment, you will need a C++ compiler. In order to receive credit, your program must compile and run; and you must provide the actual source code file so that I can compil ...

Programming assignment-1 program specification1 your

Programming Assignment- 1. Program Specification 1. Your program must read 8-bit ASCII strings from standard input -- for instance, using the cin object in C++, or stdin in C. You must consume all input from standard inp ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate