C pp Simple Programs, Cheat Sheet of Computer science

cpp simple programs solved for

Typology: Cheat Sheet

2023/2024

Uploaded on 10/10/2024

muhammad-zubair-37
muhammad-zubair-37 🇵🇰

1 document

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download C pp Simple Programs and more Cheat Sheet Computer science in PDF only on Docsity!

4/16/24, 4:35 PM 1_isSquare.cpp 1_isSquare.cpp 1| #include 2) using namespace std; 3 4) /* 5 Q No.1: Take two values of length and width of a rectangle from the user and check if it is a square or not. 6) */ 7 8) int main() 9) { 10 int length, width; 11 cout << "Enter the length of two side. \n"; 12 cin >> length >> width; 13 14 if (length == width) 15 { 16 cout << "The shape is a Square.\n"; i7 } 18 else 19 { 20 cout << "The shape is a Rectangle.\n"; 21 } 22 23 return 0; 24| } 25 lacalhost:36763/7ddec82c-1b3d-4cc5-a6f0-b0abe146c62c/ ial