








































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
C++ Programming Fundamentals is an introductory course offered by the Arab Academy for Science, Technology and Maritime Transport (AAST). The course provides students with the basic concepts and techniques required for computer programming using the C++ language. Topics include problem-solving methods, algorithms, data types, variables, operators, input and output operations, conditional statements, loops, functions, arrays, strings, pointers, and basic object-oriented programming concepts. Students learn how to design, implement, test, and debug programs to solve computational problems efficiently. Practical programming exercises and laboratory sessions help develop coding skills and logical thinking. Emphasis is placed on writing clear, structured, and maintainable programs. The course aims to establish a strong foundation in programming and prepare students for advanced courses in software development, data structures, and computer engineering.
Typology: Study notes
1 / 48
This page cannot be seen from the preview
Don't miss anything!









































Write a program to define two integer variables containing 3 and 5, then calculate their sum and their product and display the result. You must use comments. Inputs: None Outputs: sum, product Formula: sum = first + second Product = first * second Constants: first=3, second = // This program calculates the sum and product of 3 and 5 #include using namespace std; int main() { int first, second, sum, product; //declaring variables first = 3; second = 5; sum = first + second ; //calculaƟng sum product = first * second; //calculaƟng product cout<<“The sum is “<< sum<<“ \n”; cout<<“The product is “<< product<<“ \n”; return 0 ; }
#include using namespace std; int main() { int No1, No2, Temp; cout<<"Enter two numbers\n"; cin>>No1>>No2; cout<<"Before Swapping\n"; cout<<"1st Number is:"< “ArithmeƟc expressions”
An expression is a valid arrangement of variables, constants, and operators. C++ applies the operators in arithmetic expressions in a precise sequence determined by the following rules of operator precedence, which are generally the same as those in algebra:
( )
#include
2
Inputs: a, b, c Outputs: R1, R Formula: d = pow(b,2) – 4 * a * c; R1 = (-b + sqrt(d)) / (2 * a); R2 = (-b - sqrt(d)) / (2 * a); Constants: None
#include #include int main() { using namespace std; double a,b,c,d,x1,x2; cout<<"Enter the equaƟon coefficients:"; cin>>a>>b>>c; d=(bb-4ac); if (d<0) cout<<"The two roots are imaginary"; else { d=sqrt(d); x1=(-b+d)/(2a); x2=(-b-d)/(2*a); cout<<"The two roots are"<<"\n"; cout< Making Decisions (selecƟon) - II SWITCH Statement
Switch (variable) { case constant_1: acƟon_1; break; case constant_2: acƟon_2; break; case constant_3: acƟon_3; break; default: acƟon_4; }