PART II: DISCOVERY ACTIVITIES
The terms arguments and parameters means the same for noobs, but are very different in general.
PARAMETERS:- A parameter is a data variable having local or global scope in a program that is used to store the data of various types(int, float, char, etc..) during the execution of a program.
Example:- A simple program to add two no.s has only three parameters involved in its execution. Two parameters store the no.s whose sum is to be calculated while the third parameter is used for storing the calculated sum.
void add( )
{
int a=10,b=15,int sum=0; //Parameters
sum=a+b;
printf("%d",sum);
}
ARGUMENTS:- An argument is a data variable that is used to exchange information between subroutines or invoke a subroutine during function call.
Example:- Continuing with the above example, suppose if the above program to add two no.s takes input from user in a different function and the procedure to add the two no.s is stored in a different function, so in order to calculate the sum of two no.s we need to pass the two no.s to our sum function. When the sum function is invoked and the two no.s are passed during the function call, these will act as arguments for the sum function.
//function to add two no.s
void add(int a, int b) //a and b are formal arguments as their values will be exchanged from the main() function.
{ int n1,n2,sum=0; // n1 and n2 are parameters
n1=a;
n2=b;
sum=n1+n2;
printf("%d",sum);
}
//function to take inputs
void main()
{int a,b;
scanf("%d%d",&a,&b); //taking values of a and b from the user
add(a,b); // called the add function to calculate sum.
}
2. Difference between * and & operators
* operator(Indirection Operator):- This operator is used to declare pointers. Pointers are the variables that store addresses of the other variables. It is also known as dereferencing operator.
It is also used to print the value stored at an address of a variable.
& Operator(address-of-operator):- This operator is generally used to refer to the memory location where the data is actually stored. It is used when we perform parameter passing by reference.
Example:- Consider the following program:
#include<studio.h>
void main( )
{
int a=5;
int *p; //pointer for an int type variable declared using * operator
p=&a; //referencing the variable a to pointer p using the & operator
printf("%d",p) //It will print the address of variable a contained in variable p.
printf("%d",*p) //It will print the value stored at the address contained in variable p i.e. 5
}
Hope this helps :)
PART II: DISCOVERY ACTIVITIES Using your text book, or an Internet search (you can ask your...
Boolean Searches Worksheet PURPOSE Students learn to strategically search for information using Boolean operators. This provides students tools a strategies to effectively conduct information searches. INSTRUCTIONS We live in the information age. We have access to billions of websites, books, magazines, newspapers, and other sources of information at our fingertips. However, this can both help us and also hinder us. This activity will help you learn how to narrow your searches using Boolean operators such as AND, OR, and NOT....
Using the South University Online Library, the Internet, and your text readings, research the following statistical topics: Contingency tables The chi-square Fisher's exact test (FET) On the basis of your research, respond to the following: Find and state a definition of a contingency table that you feel is easy to understand. In your own words, explain what contingency tables are and what they are used for. Explain what type of data is displayed in contingency tables. Explain how contingency tables...
C++, you can skip #1
Part 2. Practice Problems The following questions ask you to write a program to compute the area of a circle using the equation A = 1 m2. The radius of the circle should be entered by the program user. 1. Draw a structure chart 2. Make a new directory called CircleFun and make it the CWD. Work inside this directory to keep your files (Main.cpp, Circle.cpp, Circle.h) grouped together 3. Using the three-file format a....
Please code in C++.
link to continue the code is this below or you can make your
own code if you wish(fix any mistakes if you think there are any in
it):
cpp.sh/3qcekv
3. Submit a header file (project3.h), a definition file (project3.cpp), a main file (main.cpp), and a makefile to compile them together. Make sure to run the command make and produce an application file and include it with your submission. For this project, you are required to create...
Part 1 Project description: You will need to select a material for “Frame of a Sport Car" using the criteria explained in chapter 7 The project is a short formal report and should include the following: . Cover page (the grading tool above and must be e-signed) • Table of content, figures and tables • Introduction (1 paragraph) • Theory about the part and its application (1 paragraph) The four steps of selecting material: (max 3 pages) Step 1- Translation:...
C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) Last Name (char[]) Age (int) Height in Inches (double) Weight in Pounds (double) You will use pass-by-reference to modify the values of the arguments passed in from the main(). Remember that arrays require no special notation, as they are passed by reference automatically, but the other...
For this project, you are tasked with creating a text-based, basic String processing program that performs basic search on a block of text inputted into your program from an external .txt file. After greeting your end user for a program description, your program should prompt the end user to enter a .txt input filename from which to read the block of text to analyze. Then, prompt the end user for a search String. Next, prompt the end user for the...
I
need help writing this code in C++
Proj11.cpp is provided as well as the randomdata.txt
thank you in advance!
Objectives: The main objectives of this project is to introduce you to recursion, and test your ability to work with some STL functionalities. A review of your knowledge on working with templates, dynamic data structures, as well as manipulating dynamic memory, classes, pointers and iostream to all extents, is also included. Description: For the entirety of this project, you will...
Assignment You will be developing a speeding ticket fee calculator. This program will ask for a ticket file, which is produced by a central police database, and your program will output to a file or to the console depending on the command line arguments. Furthermore, your program will restrict the output to the starting and ending dates given by the user. The ticket fee is calculated using four multipliers, depending on the type of road the ticket was issued: Interstate...