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++

Intro to programming in c programming assignmentassignment

Intro to Programming in C Programming Assignment Assignment purpose: User defined functions, pointers, Menu driven program A Company needs to create software for their new line of phone applications. Customers will have ...

Assignmentconsider the following declarationsclass

Assignment Consider the following declarations: class bagType { public: void set(string, double, double, double, double); void print() const; string getStyle() const; double getPrice() const; void get(double, double, dou ...

Discussionwhile loops versus for loops please respond to

Discussion "While Loops versus For Loops" Please respond to the following: • Suppose you are writing a C++ program that plays a commercial video continuously within a kiosk at your favorite shopping mall within your home ...

Modules in c are called functions c programs are typically

Modules in C are called functions. C programs are typically written by combining user created functions as well as "pre-packaged" functions found in the C Standard Library. For instance, printf() is a function that is fo ...

Assignmentinstructionsthis assignment is to implement your

Assignment Instructions This assignment is to implement your own mini-grocery store in C++. Suppose you have the following Food hierarchy: FOOD FRUIT APPLE BANANA GRAPE DAIRY MILK YOGURT CHEESE (your choice) (three items ...

Cosci 21a programming assignmentpurpose experience with

COSCI 21a, Programming Assignment Purpose: Experience with some basic data structures, including circular queues, linked lists, hash tables, and specifically with pointers and the associated dynamic memory allocation. Pr ...

Assignmentpart acomplete the following questionswrite c

Assignment Part A Complete the following questions: Write C++ code to open a document with the name Hello.txt, place the message "Hello, World!" in the document, and exit the document. Re open the file you closed, and re ...

Write a c program that calculates and prints the average of

Write a C program that calculates and prints the average of two or more salaries entered by the user. The program should first prompt the user to enter the number of salaries to process (make sure: at least 2 salaries mu ...

Write a c program that requests the name of any cartoon

Write a C program that requests the name of any cartoon character from the user, then does the following with that name (use printf for each): a. Displays it enclosed in double quotes. b. Displays it in a field 24 charac ...

1 we know that from ece 109 to calculate the

1. We know that from ECE 109, to calculate the equivalent resistance of a network of resistors in series in parallel are given by: Write a C++ program that asks the user to input values for resistors (as many as they wou ...

  • 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

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen