The document discusses various components of the C language including variables, data types, operators, and input/output functions. It defines variables as memory locations identified by names that can store values. It describes different variable naming conventions and data types including primitive, derived, and user-defined types. The document also explains various arithmetic, relational, logical, and increment/decrement operators used to manipulate variable values. It provides examples of using printf() and scanf() functions for input and output.
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Hierarchical Digital Twin of a Naval Power SystemKerry Sado
A hierarchical digital twin of a Naval DC power system has been developed and experimentally verified. Similar to other state-of-the-art digital twins, this technology creates a digital replica of the physical system executed in real-time or faster, which can modify hardware controls. However, its advantage stems from distributing computational efforts by utilizing a hierarchical structure composed of lower-level digital twin blocks and a higher-level system digital twin. Each digital twin block is associated with a physical subsystem of the hardware and communicates with a singular system digital twin, which creates a system-level response. By extracting information from each level of the hierarchy, power system controls of the hardware were reconfigured autonomously. This hierarchical digital twin development offers several advantages over other digital twins, particularly in the field of naval power systems. The hierarchical structure allows for greater computational efficiency and scalability while the ability to autonomously reconfigure hardware controls offers increased flexibility and responsiveness. The hierarchical decomposition and models utilized were well aligned with the physical twin, as indicated by the maximum deviations between the developed digital twin hierarchy and the hardware.
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
1. COMPONENT OF C LANGUAGE
(VARIABLE DATA TYPES, OPERATORS BETWEEN VARIABLES)
2. Variables
A variables is a temporary value that contains an identifier.
x=7
y=3
z=x+y
In the example, x and y are variables. Variable x is a memory location that has the identifier x and store
value 7 while variable y is a memory location that has the identifier x and store value 3. In the last line, z
also a variable. However, it use to hold the result of x+y. What do you think is the value held by z?
3. Variables
A, B and C are variables in the pseudocode
Variable names takes away the need for a programmer to access memory locations using their address
The operating system takes care of allocating space for the variables
To refer to the value in the memory space, we need to only use the variable name
4. Variables Names
A variable name is a user-defined identifier. There are general guidelines for variables name:
a) Do not use C identifiers such as printf, scanf, etc.
b) Do not use reserved words such as void, return, int, double, etc.
c) Digits as well as underscores are allowed
d) Do not use digits as the first characters.
5. Variables Names
Identifier Valid/Invalid Explanation
total Valid Valid name
_sales Valid Identifier may start with an underscore
2003sales Invalid Identifier cannot start with a digit
double Invalid It is a reserved word
puts Invalid It is an identifier
Account’s Invalid Character ‘ is not allowed
X*y Invalid Character * is not allowed
Sales2003 Valid Valid name
Net profit Invalid Spaced in between is not allowed
NETPROFIT Valid Uppercase is acceptable. However, lower case is
preferred. Upper case usually used for a constant
name
6. Data Types
We can store variables in our computer memory. Since each type of data takes
different amount of memory, like integer takes 2 bytes, decimal numbers take 4 byte,
and SINGLE character takes 1 byte. So, we must tell computer about the type of data
we are going to store in our variable.
1. Predefined/Inbuilt: These data type are inbuilt. E.g.: char, int, float, double
2. Derived data type: These data types are inherited from predefined data type. E.g.:
arrays, pointer.
3. User defined data type: These are created by user for his/her own purpose. E.g.:
typedef, enum, structure, union
10. Character Set
Character set is the set of the character
This characters are used to form the word, numbers and expression.
The characters in the c are grouped into the following categories.
Letters : Uppercase A…Z, Lowercase a…z
Digits : All decimal digits 0 to 9
Special Character : ,(comma) .(period) ; (semicolon) :(colon), & (ampersand), #
(number sign) etc.
White spaces : Blank Space, Horizontal Space, New Line.
11. Keywords
Are simply the reserved words whose meaning has been explained in library of C
language.
There are 32 keywords in c language.
We can’t use keywords as identifiers or variables because if we do so we are trying
to assign a new meaning to the keyword, which is not allowed by the computer
int float;
char if;
int void;
Above will give ERROR as we are using keywords as identifier or variable name
13. Constant
Constant names are usually all in upper case to differentiate them from variable
names.
First method: A constant is declared like a variable, except that keywords const is
added before the variable’s data type:
const int DOZEN = 12;
const double PI = 3.14;
Second method: a constant is defined using the #define pre=processor. #define is a
directive that cause the computer to replace the identifier with value it is to.
example:
#define PI 3.14
Identifier
Value
14. Backslash character constant
C supports special backslash character constants that are used in output functions.
These character combinations are known as escape sequences.
15. Comments
Comments are that part of program, which are ignored by compiler. These are used
for better readability of user. Compiler doesn‘t compile the text written inside
comments.
The comment describes the purpose of the code in the file and might include some
license or copyright information.
It is not compulsory to have comments in our program, but its good practice and
what most C programmers will expect to find.
1. Single Line Comment : // is used to make single line comment. All the text in a
line after // will become part of comment and will be ignored by compiler. E.g.,
int a; // this is ignored
2. Multiline Comment: This starts from /* and ends at */. All the text in between
these will be part of comment. E.g., /* This Is Multiline Comment */
16. Input/Output
Almost all C programs have at least one output statement. Otherwise, the program
won’t output anything on the screen and there is no knowing if the program ran
successfully or not.
The most common input/output functions are printf() and scanf() both of which are
defined in the header file stdio.h.
Use printf() (Print with Format) for outputting data to the console and scanf() (Scan
with Format) for inputting data from the keyboard.
17. Input/Output [printf ( )]
The syntax of the printf() function is
Format is the typesetting of the output that you can control, and argument is a list
of variables to be printed.
The printf() function prints the value(s) of variables in argument to the standard
output (screen) following the formatting command defined by format.
18. Input/Output [scanf ( )]
The scanf() is the inverse of printf(), i.e., it scans the value(s) of variable(s) from the
standard input (keyboard) with format. The formatting part (i.e., % …) in scanf() is the
same as printf(). However, the variable name must be preceded by an &
(ampersand).
20. Operators of C
C supports a rich set of operators. Operators are used in programs to manipulate
data and variables.
They usually form a part of the mathematical of logical expressions.
C operators are classified into several categories. They include:
1. Arithmetic operators
2. Relational operators
3. Logical operators
4. Increment and Decrement operators
22. Integer Arithmetic
When both the operands in a single arithmetic expression are integers, the
expression is called an integer expression , and the operation is called integer
arithmetic.
During modular division, the sign of the result is always the sign of the first operand.
That is
-14 % 3 = -2
-14 % -3 = -2
14 % -3 = 2
23. Real Arithmetic
An arithmetic operation involving only real operands is called real arithmetic. If x
and y are floats, then we will have:
1. x = 6.0 / 7.0 = 0.857143
2. y = 1.0 / 3.0 = 0.333333
The operator % cannot be used with real operands.
24. Mix-Mode Arithmetic
When one of the operands is real and the other is integer, the expression is called a
mixed-mode arithmetic expression and its result is always a real number.
Eg: 15 / 10.0 = 1.5
25. Relational Operators
The relational operators are mathematical operators often used in the if statement.
It is important to understand the difference between a single equal sign (=) and
double equal signs (==) as the single equal sign (=) is used for an assignment while
the double equal signs (==) are used as mathematical equality.
26. Relational Operators
1. if (a==b) printf("a and b are equal.n");
else printf("a and b are not equal.n");
The statement above means that if the two variables, a and b, are the same, a string, “a and b
are equal.”, is printed, otherwise a string, “a and b are not equal.”, is printed.
One equal sign is for assignment and two equal signs are for logical equality. The double equal
signs in C are equivalent to the equal sign in regular mathematical equations.
27. Relational Operators
1. a = 10;
a = a + 1;
The statement a = a + 1 does not make sense as a mathematical expression. However, it makes
perfect sense as a C statement. a + 1 is first evaluated to be 11 and this value of 11 is then
assigned to a. Effectively, the value of a was incremented by 1.
30. Increment/Decrement/Substitution Operators
C has two very useful operators that are not generally found in other languages.
These are the increment and decrement operator:
++ and –
The operator ++ adds 1 to the operands while – subtracts 1. It takes the following
form:
++m; or m++
--m; or m—
31. Increment/Decrement/Substitution Operators
Rules for ++ & -- operators
These require variables as their operands.
When postfix either ++ or – is used with the variable in each expression, the
expression is evaluated first and then it is incremented or decremented by one
When prefix either ++ or – is used with the variable in each expression, it is
incremented or decremented by one first and then the expression is evaluated with
the new value
33. EXERCISE
1. Print a character, “a”.
2. Print an integer 10
3. Print floating number 10.5
4. Print two floating numbers, 10.0 and -2.3
5. Write a program that reads temperature in Celsius and convert it to Fahrenheit.
Note
𝐶 = 𝐹 − 32 𝑋
5
9
Expected result
Editor's Notes
NOTE:
To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image.