The document contains instructions for a programming assignment that involves:
1) Explaining mixed mode operators with an example.
2) Choosing a control statement to separate a group into age categories (child, young, old) and explaining the choice.
3) Writing C++ expressions for mathematical expressions.
4) Identifying invalid variable names and explaining why.
5) Writing output for code snippets involving conditions and math.
6) Providing an operator precedence table.
7) Writing a program to determine the type of triangle based on side lengths.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
44 views
Assignment
The document contains instructions for a programming assignment that involves:
1) Explaining mixed mode operators with an example.
2) Choosing a control statement to separate a group into age categories (child, young, old) and explaining the choice.
3) Writing C++ expressions for mathematical expressions.
4) Identifying invalid variable names and explaining why.
5) Writing output for code snippets involving conditions and math.
6) Providing an operator precedence table.
7) Writing a program to determine the type of triangle based on side lengths.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1
Problem Solving Using Computers 1st Assignment (J section)
Date: 13-9-2006 Submission date: 23-09-2006
1. What do you mean my mixed mode operators? Explain with example. 2. In case of separating a group of people into child, young and old depending on the age group, which control statement you would like to choose and why? 3. Write the c++ equivalent expression for the following expressions a) ay2 + by + c/2 d b) ex sinx-y3 b) (x/y)n-1 1/(2) 4. Point out which of the following variables are invalid and Give the reason. a) she shells b) she_he c) hope-best d) sum0123averagetruefalse e) avg. f) fact12.34 g) FOR h) IF ELSE 5. Write the output of the following problems with explanation a. int x; x=4%5+6%5; cout<<x; b. int x=10,y=5,p,q; p=x>9; q=x>3&&y!=3; cout <<p<<q; c. int a=12.25,b=13.65; if(a=b) cout<<a and b are equal; else cout<<a and b are not equal; d. int i=400*400/400; if(i= =400) cout<<good boys; else cout<<good girls; e. int k=12 , n=30; k=(k>5 && n=4 ? 100:200); cout<<k; 6. Give the precedence table for the operators. 7. Write a program to accept the lengths of the three sides of a triangle A, B, and C and determines the type of triangle. Type of triangle is based on =standard mathematical relations and summarized as below. Let x denotes the largest of A, B, and C sides and let y and z be the other two sides. Then, i. if x>y+z no triangle is formed. ii. if x=y=z equilateral triangle is formed iii. ifx=y or y=z or z=x isosceles triangle is formed 2 2 2 iv. if x =y +z right-angled triangle is formed 2 2 2 v. if x >y +z obtuse-angled triangle is formed 2 2 2 vi. if x <y +z acute-angled triangle is formed