You are on page 1of 5

COMPARISION B/W STRINGS AND INTEGERS

SAMAR SUNIL
B-27445
PROGRAMMING FUNDAMENTALS
Instructor: Ayesha Muqadas
Strings: Strings in C++ are used to handle and manipulate text or character-
based data. They allow you to work with sequences of characters effectively.
Example: A =“Sacks”, B=“Eggs”, C=“Headlight” etc.

Integers: Integers in C++ is a data type are used to work with whole
numbers without any fractional or decimal component. They are essential for
performing mathematical calculations and storing numerical data in programs.
Example: A=123, B=455, C=420 etc
PROGRAMMING EXAMPLE
Strings Integers
#include <iostream> #include <iostream>
Using namespace std; Using namespace std;
Int main () Int main ()
{ {
String greeting=“hello”; Int myNum=420;
Cout<<greeting; Cout<<myNum;
Return 0; Return 0;
} }
COMPARISION
Strings Integers
- Equality (==) and Inequality (!=) - Equality (==) and Inequality (!=)
Operators: Check if two strings are the Operators: Check if two numbers are
same or different. the same or different.
- Relational Operators (<, >, <=, >=): - Relational Operators (<, >, <=, >=):
Compare strings based on their order Compare numbers based on their
in the dictionary. magnitude (size).
THANK YOU FOLKS!

SAMAR SUNIL
B-27445
PROGRAMMING FUNDAMENTALS
Instructor: Ayesha Muqadas

You might also like