Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views7 pages

CP Assignment

The document outlines an assignment for a Computer Programming course at Allama Iqbal International University, submitted by Mian Abd ur Rehman Ijaz. It includes a series of C++ programs addressing various tasks such as finding maximum numbers, checking divisibility, and validating triangles, as well as a discussion on types of errors in C/C++ and the role of Integrated Development Environments (IDEs) in programming. The document emphasizes debugging techniques and the features of popular IDEs like Dev C++, Code::Blocks, and Visual Studio.

Uploaded by

h6727251
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views7 pages

CP Assignment

The document outlines an assignment for a Computer Programming course at Allama Iqbal International University, submitted by Mian Abd ur Rehman Ijaz. It includes a series of C++ programs addressing various tasks such as finding maximum numbers, checking divisibility, and validating triangles, as well as a discussion on types of errors in C/C++ and the role of Integrated Development Environments (IDEs) in programming. The document emphasizes debugging techniques and the features of popular IDEs like Dev C++, Code::Blocks, and Visual Studio.

Uploaded by

h6727251
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

allama Iqbal International University

Assignment :1

Subject : Computer programing 3504

Sunmitted by :

Mian Abd ur Rehman Ijaz

user id: 0000955057

Submitted To:

Mam Yusra

Topic:

c ++ programs

Class :

BS Artificial Intelligence

program 1

take two inputs and give max number output:

program 2
check if the number is divisible by 5 and 11

program 3

check if a triangle is valid or not:

program 4

take basic value from a user and give gross salary


program 5

check the value is a digit or alpabet

program 6

find the input value is a palindorme or not


program 7

swap the values without using third variable

program 8

reverse the input 5 digits


Question 9

Types of Errors in C/C++:


Syntax Errors:

These occur when the code violates the grammatical rules of the language. Common examples include
missing semicolons, incorrect braces, or misspelled keywords.Example: int main() { cout << "Hello,
World!" } (missing semicolon).

Logical Errors:

These occur when the code runs without crashing, but the output is incorrect due to a flaw in the
program's logic. These are often hard to detect since the program runs.Example: A program that
calculates the average but divides by the wrong number.

Runtime Errors:

These happen during the execution of the program, often due to invalid operations like dividing by zero or
accessing invalid memory.Example: int x = 10 / 0; causes a division by zero runtime error.

Debugging in C/C++:

IDE/Debugger Tools:Integrated Development Environments (IDEs), such as Visual Studio or


Code::Blocks, typically offer built-in debuggers that let you step through code, set breakpoints, and
inspect variables.

GDB: The GNU Debugger (GDB) is a powerful tool for debugging C/C++ programs. You can compile
the code with debugging information (g++ -g) and then run it in GDB to find and fix issues cout
Statements: Inserting cout statements at key points in the program can help trace the flow and check the
values of variables

Question 10

Role of an IDE:
Helps Write, Edit, Compile, and Debug Code:

IDEs make coding more efficient by offering tools that streamline the entire development process. They
provide code editing features like auto-completion, syntax highlighting, and refactoring tools.

Examples:

Dev C++: A lightweight IDE popular for C/C++ development.

Code::Blocks: A free, open-source IDE that offers flexibility and support for multiple compilers.

Visual Studio: A powerful IDE, especially for larger C++ projects, with robust debugging and profiling
tools.

Features:

Syntax Highlighting: Makes it easier to identify errors and understand code structure.

Auto-Completion: Helps speed up coding and reduce errors by suggesting code completions.

Debugging Tools: IDEs provide integrated debuggers for setting breakpoints and inspecting variable
values.

Project Management: Helps manage large projects with multiple files and dependencies.

You might also like