This action might not be possible to undo. Are you sure you want to continue?

Welcome to Scribd! Start your free trial and access books, documents and more.

Find out more1 Declare a global (type double) variable "Ref" and initialize it to 10.5. 2.2 Input/Output 1. Display informations on the variable "Ref" and display its value with the function cout.

2. Ask the user to enter a value to initialize a (type double) "a" variable with the cin funtion.

Initialize a (type double) "b" variable with a pseudo-randomly value generated with the rand function. Hence. . Initialize "b" with the formula: Min + (int)(rand()/((double)RAND_MAX + 1)∗Max) Remark: To generate different sequences of numbers.3. To get rid of this problem. The number has to be in the range: [M in. 100]. 4. we choose time as the value. we use srand() function where we have to initialise the seed with a value that changes with execution. M ax] = [1. Declare Min and Max as global variables. Note: Here we see that the number is pseudo random in the way that although the number is picked up randomly but the same random number is picked at later executions. you have to initialize the seed by adding the instruction: srand(time(NULL)).

in order to retain the decimal point information. Compare the mean value computed to the "Ref" value and display "superior to ref" or "inferior to ref" according to the result.2 Min and max 1.3. So.2. 2. Note: The mean has to be declared as double as it may or may not be an integer. max. we should declare it as double.3.1 Mean Compute and display the mean value of the variables "a" and "b". min computation 2.3 Mean. .

2. Compute and display the maximum of the two variables "a" and "b". Compute and display the minimum of the two variables "a" and "b".1 Factorial . 3 Combination 3. 3.

Compute the factorial of the value entered by the user. Verify that the value entered is an integer superior or equal to zero. Note: Here I have used the do-while loop because I want to check the condition after the input has been taken.1. Also. although they are going to be integers only. . Same goes for the rest of the problems of the 3rd section. but I have taken them to be double as a double variable has more length than int. 2.2 Number of combinations from a set Compute and display the number of combination of a lottery game (49 different numbers). Declare a (type double) new variable "c" and ask the user to enter a value to initialize it. where the player must choose 6 different numbers. the variable c and fact. ask the user to enter a new value until the value is correct (not only once). and if not. 3. 3.

3.3 Number of combinations with repetitions Compute and display the number of possible combinations of the Yathzee game. where the player rolls 5D6 .

4 Permutations In a set of 54 cards.3. what is the number of permutation if you choose 5 cards (poker)? 4 List fo Fibonacci numbers and its relation to the golden ratio .

I have chosen to stick to the for loop only.2 Approximation to the golden ratio .4.1 Compute and display 20 first numbers of the fibonacci’s list Note: This problem can be solved by using functions as well. 4. But.

.

5 Pascal’s Triangle .000001 for the 18th number in the series onwards.Note: Here we see that the ratio of consecutive fibonacchi numbers is less than .

. it is not clearly visible.Note: The last row which seems to be 1x^0y^9 is the last column in previous row. Due to the limitations of the output console.

C++ basics

C++ basics

- Unit3Lecture1_VariablesAndExpressions
- Variables and User Input
- AutoLISP Lesson 5 - VARIABLES - Draftsperson
- comp
- JSOO
- Intrebari Freelancer
- 2. Primitive Data Types and Variables Homework
- User Manual_Motion Control Module Instructions_Eng_V1.0
- CS 107reading
- Arena Variables Guide
- Proc 9
- Unix_Unit-3
- C-Programming-Optimization Techniques Class 2
- Java 2
- How to... Verify the Variable Input
- Week4 Document Object Model
- TacXenta102AX
- VensimTut
- Tcp c Language
- mid1 pt 1
- CodeConventions_Java
- Post Lamb
- ds-qns
- l22
- MQL4 Language for Newbies.pdf
- Fusion Fast Formulas Guide
- Mathematical Relations 1
- Authorization n Nw Bi
- Derivatives and Frechet DifferentiaIs
- Hash Survey

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd