Exam (june ) Estimated solving time (10 min) screen shot :- to download the open source click the next url :
|
|
- Brice Chambers
- 5 years ago
- Views:
Transcription
1 Exam (june ) Estimated solving time (10 min) screen shot :- to download the open source click the next url : Page 1
2 code : #include <cstdlib> #include <iostream> using namespace std; struct age_struct int years; int months; int weeks; int days; ; long age_by_days(age_struct); int main(int argc, char *argv[]) char scape; do age_struct newage; cout<<"years :"; cin>>newage.years; cout<<"months :"; cin>>newage.months; cout<<"weeks :"; cin>>newage.weeks; cout<<"days :"; cin>>newage.days; long days = age_by_days(newage); cout<<"your age by days = "<<days<<endl; cout<<"do you want to enter new age"<<endl; cout<<"enter y for new age or any key to exit"<<endl; cout<<"your choice :"; cin>>scape; while(scape =='y' scape=='y'); system("pause"); return EXIT_SUCCESS; long age_by_days(age_struct myage) static int count =0; count++; cout<<"i have been called for "<<count<<" time(s)"<<endl; long days =0; days += myage.years * 365; days += myage.months * 30; days += myage.weeks * 7; days += myage.days; return days; Page 2
3 estimated solving time (5 min) screenshot :- Page 3
4 code : #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) for(int l=1;l <= 4;l++) for(int sp=0;sp<-l+4;sp++) cout<<" "; for(int st=0;st<2*l-1;st++) cout<<"*"; cout<<endl; for(int l=1;l<=3;l++) for(int sp=0;sp<l;sp++) cout<<" "; for(int st=0;st<-2*l+7;st++) cout<<"*"; cout<<endl; system("pause"); return EXIT_SUCCESS; Page 4
5 Estimated solving time (10 min) screenshot :- Page 5
6 code : #include <cstdlib> #include <iostream> using namespace std; long factorial(long); long myfact =1; int main(int argc, char *argv[]) long x=0; char scape; do do cout<<"x ="; cin>>x; while(x <0); if(x==0) cout<<"!"<<x<<" =1"<<endl; else cout<<"!"<<x<<" ="; long f=factorial(x); cout<<"="<<f; myfact =1; cout<<endl<<"do you want to perform new progress"<<endl; cout<<"for new one enter y or any key to exit"<<endl; cout<<"your choice :"; cin>>scape; while(scape =='y' scape=='y'); system("pause"); return EXIT_SUCCESS; long factorial(long x) cout<<x; if(x>1) myfact *=(x--); cout<<"*"; factorial(x); return myfact; Page 6
7 estimated solving time (5 min) screenshot :- code :- for(int o=0;o<4;o++) for(int i=0;i<4;i++) if((o+i)== 3 o==i) sum += x[o][i]; Page 7
8 estimated time (5 min) code :- int m,n,x; cin>>m>>n>>x; switch(x) case 1: case 2: case 3: default: cout<<m-n; break; cout<<m-n; break; cout<<m+n; break; cout<<m*n; Page 8
9 Exam June 2012 Screenshot :- estimated time (10 min) Page 9
10 code :- #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) const int s_count=5; const int g_count=5; int students[s_count][g_count]; for(int s=0;s<s_count;s++) cout<<"enter Grades of Studnet no :"<<s+1<<endl; //clear the total element students[s][4] =0; for(int g=0;g<g_count-1;g++) //be sure that the grade between 0 and 100 do cout<<"subject "<<g+1<<" : "; cin>>students[s][g]; while(students[s][g] >100 students[s][g] <0); students[s][4] +=students[s][g]; cout<<"total grades :"<<students[s][4]<<endl; cout<<"grades average :"<<students[s][4]/4<<endl; cout<<endl; system("pause"); return EXIT_SUCCESS; Page 10
11 Exam Jan 2010 estimated time (5 min) Screenshot :- Page 11
12 Code : #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) int x[5][4]; for(int i=0;i<5;i++) for(int j=0;j<4;j++) cout<<"value of "<<i<<" : "<<j<<" = "; cin>>x[i][j]; cout<<endl; int sum =0; for(int i=0;i<5;i++) for(int j=0;j<4;j++) if(i==2 j==2) sum += x[i][j]; cout<<endl; cout<<"sum of selected elements = "<<sum<<endl; system("pause"); return EXIT_SUCCESS; Page 12
13 estimated time (5 min) screenshot:- Page 13
14 Code : #include <cstdlib> #include <iostream> using namespace std; bool iseven(int); int main(int argc, char *argv[]) int arr[10]; char scape; do for(int i=0;i<10;i++) cout<<"number "<<i+1<<" = "; cin>>arr[i]; if(iseven(arr[i])) cout<<"the number "<<arr[i]<<" is even"<<endl; cout<<"do you want to try it again?"<<endl; cout<<"for new progress enter y or any key to exit"<<endl; cout<<"your choice :"; cin>>scape; while(scape == 'y' scape =='Y'); system("pause"); return EXIT_SUCCESS; bool iseven(int num) if(num % 2==0) return true; else return false; Page 14
15 estimated time (less than 5 min) screenshot:- Page 15
16 Code :- #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) int item_id =0; char scape; do cout<<"enter Item ID from 1,4"<<endl; cout<<"you selected :"; cin>>item_id; switch(item_id) case 1: cout<<"the price 100"<<endl; break; case 2: cout<<"the price 200"<<endl; break; case 3: cout<<"the price 600"<<endl; break; case 4: cout<<"the price 150"<<endl; break; default : cout<<"invalid Item ID"<<endl; cout<<"do you want to perform new search?"<<endl; cout<<"for new progress enter y or any key to exit"<<endl; cout<<"your choice :"; cin>>scape; while(scape =='y' scape =='Y'); system("pause"); return EXIT_SUCCESS; Page 16
17 estimated time (20~30 min) Screenshot : Page 17
18 Code recursive function :- #include <cstdlib> #include <iostream> using namespace std; /*argumenet details 1-int arr[] the array 2-int* pointer for how many times the target number has been found 3-int the target number which will be searched for in the passed array 4-int index for recursive function which will tell the function when it has to stopped 5-int last index the target number has been found on 6-last argumenet which tells the function the size of the array */ void location_of_target(int arr[],int*,int,int,int*,int); int main(int argc, char *argv[]) const int arr_size = 7; int arr[arr_size]; int target_num =0; for(int i=0;i<arr_size;i++) cout<<"enter Number "<<i+1<<" = "; cin>>arr[i]; cout<<endl<<"enter the Target Number ="; cin>>target_num; int count =0; int res =-1; location_of_target(arr,&count,target_num,0,&res,arr_size); if(res!= -1) cout<<"the number : "<<target_num<<" found "<<count<<" times and lat (largest) index was: "<<res<<endl; else cout<<"the number : "<<target_num<<" does not exist in the passed array"<<endl; system("pause"); return EXIT_SUCCESS; void location_of_target(int arr[],int* count,int target,int index,int* last_index,int size) if(index <size) if(arr[index] == target) *count = *count+1; *last_index = index; index++; location_of_target(arr,count,target,index,last_index,size); Page 18
19 code (2) : #include <cstdlib> #include <iostream> using namespace std; /*arguement details 1-int [] the passed array 2-int* pointer for the count how many times the target number found 3-int the target number 4-the size of array*/ int location_of_target(int[],int*,int,int); int main(int argc, char *argv[]) const int size =7; int arr[size]; int count =0; int target_num; for(int i =0;i< size;i++) cout<<"number "<<i+1<<" = "; cin>>arr[i]; cout<<"target Number ="; cin>>target_num; int res = location_of_target(arr,&count,target_num,size); if(res!= -1) cout<<"the number : "<<target_num<<" found "<<count<<" times and lat (largest) index was: "<<res<<endl; else cout<<"the number : "<<target_num<<" does not exist in the passed array"<<endl; return 0; int location_of_target(int arr[],int* count,int target_num,int size) static int last_index =-1; for(int i=0;i< size;i++) if(arr[i] == target_num) *count = *count +1; last_index =i; return last_index; Page 19
20 Exam june 2007 Estimated time (15~20 min) screenshot Page 20
21 code (2) #include <cstdlib> #include <iostream> using namespace std; int fib(int); int main(int argc, char *argv[]) int max=0; cout<<"enter your last elemet of fibonacci series"<<endl; cout<<"last element :"; cin>>max; for(int i=0;i<=max;i++) cout<<fib(i)<<" "; cout<<endl; system("pause"); return EXIT_SUCCESS; int fib(int n) if(n==1 n==0) return n; else return fib(n-1)+fib(n-2); Page 21
22 Screenshot:- Page 22
23 code :- #include <cstdlib> #include <iostream> using namespace std; void reverser(char*); void copy_reverser(char*,char*); int main(int argc, char *argv[]) const int size =20; char word[size]; char word_copy[size]; char scape; do cout<<"enter your word :"; cin>>word; copy_reverser(word,word_copy); cout<<"the Original String :"<<word<<endl; cout<<"the Revered Copy :"<<word_copy<<endl; reverser(word); cout<<"the Original Reversed String :"<<word<<endl; cout<<endl<<"do you want to enter new word?"<<endl; cout<<"for new word enter y or any key to exit"<<endl; cout<<"your choice :"; cin>>scape; while(scape == 'y' scape =='Y'); return (0); void reverser(char* ptr) for(;*ptr!='\0';ptr++) for(char* ptr2=ptr+1;*ptr2!= '\0';ptr2++) char temp = *ptr2; *ptr2 = *ptr; *ptr = temp; void copy_reverser(char *ptr,char* copy) int size=0; for(;*ptr!='\0';ptr++,copy++) *copy = *ptr; size++; *copy='\0'; copy -=size; for(;*copy!='\0';copy++) for(char* ptr2=copy+1;*ptr2!= '\0';ptr2++) char temp = *ptr2; *ptr2 = *copy; *copy = temp; Page 23
24 Screenshot :- Page 24
25 code : #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) int a,b,c,d=0;int a1,b1=0; char dummy_opera1,dummy_opera2;char operation; char scape; do cout<<"enter your Operation like"<<endl; cout<<"\t a \t \t b"<<endl; cout<<"\t \toperator\t"<<endl; cout<<"\t-----\t \t-----"<<endl; cout<<"\t b\t \t d"<<endl; cout<<"the Operation :"; cin>>a>>dummy_opera1>>b>>operation>>c>>dummy_opera2>>d; switch(operation) case '+': a1 = (a*d)+(b*c); b1=(b*d); break; case'-': a1=(a*d)-(b*c); b1=(b*d); break; case'*': a1=(a*c); b1=(b*d); break; case '/': a1=a*d; b1=b*c; break; default: cout<<"invalid operator"<<endl; cout<<"you entered :"<<endl; cout<<"\t "<<a<<" \t \t "<<c<<"\t\t "<<a1<<endl; cout<<"\t \t "<<operation<<endl; cout<<"\t-----\t \t-----\t=\t----"<<endl; cout<<"\t "<<b<<"\t \t "<<d<<"\t\t "<<b1<<endl; cout<<endl<<"do you want to perform new calculation?"<<endl; cout<<"for new calculation enter y or any key to exit"<<endl; cout<<"your choice:"; cin>>scape; while(scape =='y' scape=='y'); system("pause");return EXIT_SUCCESS; Page 25
26 Jan Page 26
27 Code :- #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) const int size=20; int num,first_index,last_index,count =0; int arr[size]; for(int i=0;i<size;i++) cout<<"number "<<i+1<<" = "; cin>>arr[i]; //start sorting the array for(int i=0;i<size;i++) //bool issorted = true; for(int n=i+1;n<size;n++) if(arr[i] > arr[n]) //issorted = false; int temp = arr[i]; arr[i] = arr[n]; arr[n] = temp; /*if(issorted) break; */ cout<<endl<<"your array sorted ascending"<<endl; cout<<"do you want to extract your sorted array?"<<endl; char dic; cout<<"enter y for extracting your sorted array or any key to continue"<<endl; cout<<"your choice :"; cin>>dic; if(dic =='y' dic=='y') for(int i=0;i<size;i++) if(i % 10!=0) cout<<arr[i]<<" "; else cout<<endl<<arr[i]<<" "; Page 27
28 char scape; do cout<<"search for :"; cin>>num; first_index =0; last_index =0; count =0; for(int i=0;i<size;i++) if(num >= arr[i]) if(num == arr[i]) if(count ==0) first_index =i; else last_index =i; count++; else break; if(count > 0) cout<<"your number ("<<num<<") is found "<<count<<" times"<<endl; cout<<"first time was at "<<first_index<<" and last time was at "<<last_index<<endl; else cout<<"the entered element is not found"<<endl; cout<<"do you want to peform a new search?"<<endl; cout<<"for new search enter y or any key to exit"<<endl; cout<<"your choice :"; cin>>scape; while(scape =='y' scape=='y'); system("pause"); return EXIT_SUCCESS; Page 28
29 Extra Practice :- 1)Write a full program (starting from #include) that counts the number of character doubles in a phrase entered by the user. The output should look like the example below. Note there are 3 character doubles in this example input: "bb", "oo", and "!!" Enter phrase: Hobbits love cookies!! There are 3 character doubles. You do not have to worry about detecting upper vs. lower-case letters, nor do you have to handle the case when a character occurs three times or more in a row ) Write a program (starting from #include) that repeatedly collects positive integers from the user, stopping when the user enters a negative number or zero. After that, output the product of all positive entries. A sample run should appear on the screen like the text below. Enter a number: 3 Enter a number: 10 Enter a number: 2 Enter a number: -213 The product of all your positive numbers is ) Write a full program (starting from #include) that reads in an input phrase and removes all occurrences of the word "the" (all lower-case). You do not need to worry about words that contain the letters in "the", such as the word "theory". Page 29
30 A sample run is shown below. Enter a phrase: The light of the moon on the ring by the volcano. The light of moon on ring by volcano ) In Old English, the letter "s" was stylized so that it looked more like the letter "f". Write a program (starting from #include) that takes an input phrase from the user and changes every s to an f. Your result should preserve case, so that a lower-cases becomes f and a capital S becomes F. Furthermore, report the total number of letters you changed. Your program should make only one pass through the input phrase. A sample run is shown below. Enter your phrase: Some say Samwise is short for a hobbit. In Old English: Fome fay Famwife is fhort for a hobbit. Changed 5 letters )Create the equivalent of a four-function calculator. The program should ask the user to enter a number, an operator, and another number. (Use floating point.) It should then carry out the specified arithmetical operation: adding, subtracting, multiplying, or dividing the two numbers. Use a switch statement to select the operation. Finally, display the result. When it finishes the calculation, the program should ask whether the user wants to do another calculation. The response can be y or n. Some sample interaction with the program might look like this: Enter first number, operator, and second number: 10 / 3 Answer = Do another (y/n)? y )Write a C++ program that accepts a number and displays its factorial (factorial (x)=(x-1)*(x- 2)*(x-3) *3*2*1). Interaction with the program might look like this: Enter a number: 5 Page 30
31 The factorial is: )Write a program that counts the words with size greater than two characters and the number of all characters (ignore spaces) in a phrase typed in by the user. The program accepts the phrase character by character using the function getche() until press the enter key. Interaction with the program might look like this: Enter the text: welcome to c++ Count of words is: 2 Count of characters is: )Write a program that accepts an array of string then copies that string in another array in a reverse order. Then display both of the original string and its reverse. For example, if you entered "hallo" in the first array, the program will reverse it to be "ollah" in the second array 9) write an a program that accepts 100 decimal number then compute the average of the entered numbers. Attempt to put the numbers less than the average in another array lessavg[] and the numbers greater than the average in a third array greateravg[]. Finally, display the two averages of the numbers in both of lessavg[] and greateravg[] ) An integer is said to be prime if it is divisible by only 1 and itself. For example, 2, 3 and 5 are prime, but 4, 6 and 8 are not. Response to the following requirements: a) Write a function that determines whether a number is prime. b) Use this function in a program to determine and print all the prime numbers between 1 and ) Raising a number n to a power p is the same as multiplying n by itself p times. Write a function called power() that takes a double value for n and an int value for p, and returns the result as a double value. Use a default argument of 2 for p, so that if this argument is omitted, Page 31
32 the number n will be squared. Write a main() function that gets values from the user to test this function ) Write a function multiple that determines for a pair of integers whether the second integer is a multiple of the first. The function should take two integer arguments and return true if the second is a multiple of the first, false otherwise. Use this function in a program that inputs a series of pairs of integers ) Write a function called swap() that interchanges two int values passed to it by the calling program. (Note that this function swaps the values of the variables in the calling program, not those in the function.) You ll need to decide how to pass the arguments. Create a main() program to exercise the function )Write a program that accepts array of 10 integers and print to as a reversed array so, the reversed one will have the first in reverse. get the average for the even numbers )Write a C++ program that displays a menu for the user: Enter a number x and display it's square Enter a number x check if it is greater than or less than or equal to 1 Enter number x and check if it is multiple of 7 or not )Write a program that calculate the following S= n )Write a program that calculate the following sequence Page 32
33 S= n )Write a program that asks the user to enter an array of 10 integers. The program must count the number of integers greater or equal to 10 and compute their summation and average )Write a program that asks the user to enter an array of 10 integers. The program must count the number of integers that are divisible by5 and compute their summation and average ) Write a program that sorts the array s elements in an ascending order ) Convert the following code by using for loop and switch statement : int x; cin >> x; do if(x % 2 == 0) cout << 2 << endl; else if (x % 3 == 0) cout << 3 << endl; else if(x % 4 == 0) cout << 4 << endl; else cout << "unknown"; while(++x <= 30); Page 33
34 2-OutPut Practice : # include <iostream.h> int main() int x[4] = 4,3, 2 ; int* ptr; ptr=x; for(int j=0; j<4; j++) cout << " " <<++*(x+j) * x[j] << endl; return 0; #include<iostream.h> void sp(float* j,float* i, int* count) static int c=0; float n; c++; *count=c; n=*j*2; *j=*i*2; *i=n; int main() float x=5, y=10; char ch; int c; sp(&x, &y, &c); cout<<"\n x and y become : "<<x<<" and " <<y; cout<<"\n the value of c is: "<<c; sp(&x,&y, &c); cout<<"\n x and y become : "<<x<<" and " <<y; cout<<"\n the value of c is: "<<c; return 0; #include <iostream.h> #include <cstring> int main() char str1[] = "Good luck"; int MAX = strlen(str1); char str2[100]; for(int j=1; j<=max; j++) str2[max-j] = str1[j-1]; str2[max]='\0'; cout << str2 << endl; return 0; #include<iostream.h> int main() int x =8; do x+=2; cout<<"\n "<<x; while(x<20); return 0; #include<iostream.h> int main() int x=3, y=2, z=1; bool b, c=0; b=x<y==++z>y; cout<<"\n "<<b; b=z<-1==x++>--y; cout<<"\t "<<b; c= 100*-30/2; cout<<"\t "<<c; x=++x+x--; cout<<"\t "<<x; return 0; #include<iostream.h> void repchar() for(int j=0; j<4; j++) cout << '*'; cout << endl; void repchar(char ch) for(int j=0; j<4; j++) cout << ch; cout << endl; void repchar(char ch, int n) for(int j=0; j<n; j++) cout << ch; cout << endl; int main() repchar(); repchar('+',7); repchar('='); return 0; hint(overloading) Page 34
35 char y = 'a'; int x = 30; int z = 10; y = y + (x++ % z) +3 ; cout<<x++; cout<<++y<<endl; z = x z; z = z++ * ++x; cout<<z<<endl; #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) char ch; char title[] = "Titanic"; ch = title[1]; title[3] = ch; cout << title << endl; cout << ch << endl; return 0; #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) int n; float x = 3.8; n = int(x); cout << "n = " << n << endl; return 0; #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) int i = 5, j = 6, k = 7, n = 3; cout << i + j * k - k % n << endl; cout << i / n << endl; int found = 0, count = 5; if (!found --count == 0) cout << "danger" << endl; cout << "count = " << count << endl; return 0; #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) const int LENGTH = 21; char message[length]; cout << "Enter a sentence on the line below." << endl; cin >> message; cout << message << endl; /* Suppose that in response to the prompt, the interactive user types the following line and presses Enter: Please go away. What will the output of the code fragment look like?*/ return 0; #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) int x=1, y=2; x++; x+=2; x%=3; y*=2; y/=2; if( ( y < x ) ( x >= 3) ) cout <<y; else cout <<x; return 0; Page 35
36 True or false An array can store many different types of values If three are fewer initializers than the number of elements in the array, the remaining elements are automatically initialized to the last value in the list of initializers "\n " Position the screen cursor to the beginning of the current line "\a " Position the screen cursor to the beginning of the new line When arguments are passed by value, the function works with the original arguments in the calling program Data items in a structure are public by default (False) (False) (False) (False) (False) (True) Page 36
37 Choices : 1. Answer the following multiple-choice questions: I. How many times is a do while loop guaranteed to loop? II. III. A. 0 B. Infinitely C. 1 D. Variable What is required to avoid falling through from one case to the next? A. end; B. break; C. Stop; D. A semicolon. What keyword covers unhandled possibilities in a switch statement? A. all B. contingency C. default D. other IV. What is the final value of x when the code int x; for(x=1; x<10; x+=2.7) is run? A. 10 B. 9 C. 0 D. 11 V. The library function exit() causes an exit from A. the loop in which it occurs. B. the block in which it occurs. c. the program in which it occurs. VI. A variable defined within a block is visible A. from the point of definition onward in the program. B. from the point of definition onward in the function. C. from the point of definition onward in the block. D. throughout the function. VII. Assuming a nested loop with a switch statement in the inner loop, a break statement in a switch case causes an exit : A. only from the innermost loop. B. only from the switch statement. c. from all loops and switches. d. from the innermost loop or switch. VIII. How many times the loop body will be executed when running the code for(;;)? A. 0 B. 1 C. Infinitely D. Variable Page 37
38 shapes :- 1- Code : #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) for(int l=1;l<=6;l++) int r_astrisk_cond=7-l; int l_astrisk_cond=7-l; int mid_space_cond=2*l-2; for(;r_astrisk_cond>0;r_astrisk_cond--) cout<<"*"; for(;mid_space_cond >0;mid_space_cond--) cout<<" "; for(;l_astrisk_cond>0;l_astrisk_cond--) cout<<"*"; cout<<endl; system("pause"); return EXIT_SUCCESS; Page 38
39 2- Write a program to solve this shape by coding code : #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) int i=1; for(int l=1;l<=5;l++,i+=2) for(int n=0;n<11-2*l;n++) cout<<i; cout<<endl; system("pause"); return EXIT_SUCCESS; Page 39
40 Page 40
41 code : #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) int choice = 0; do cout<<"if you want to exit press 0."<<endl; cout<<"please select shape from 1-4."<<endl; cin>>choice; switch (choice) case 1: for(int line =1;line <=10;line++) for(int star=1;star <= 1+(line -1)*1;star++) cout<<"*"; cout<<endl; break; case 2: for(int line =1;line <= 10;line++) for(int star = 1;star <= 10+(line-1)*-1;star++) cout<<"*"; cout<<endl; break; case 3: for(int line=1;line<=10;line++) for(int space =1;space <= 0+(line-1)*1;space++) cout<<" "; for(int star =1;star <= 10+(line -1)*-1;star++) Page 41
42 cout<<"*"; cout<<endl; break; case 4: for(int line =1;line<=10;line++) for(int space=1;space <= 9+(line-1)*-1;space++) cout<<" "; for(int star=1;star<=1+(line-1)*1;star++) cout<<"*"; cout<<endl; default: cout<<"please insert correct choice between 1-4"; while(choice!=0); system("pause"); return EXIT_SUCCESS; نسأ لمك صاحل ادلعاء Page 42
c++ Solutions eedsohag.epizy.com Ahmed Ali
c++ s Ahmed Ali int main(int argc, char *argv[]) int age; age=10; cout
More informationC++ PROGRAMMING SKILLS Part 2 Programming Structures
C++ PROGRAMMING SKILLS Part 2 Programming Structures If structure While structure Do While structure Comments, Increment & Decrement operators For statement Break & Continue statements Switch structure
More information1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.
1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. B. Outputs to the console a floating point number f1 in scientific format
More informationREPETITION CONTROL STRUCTURE LOGO
CSC 128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING REPETITION CONTROL STRUCTURE 1 Contents 1 Introduction 2 for loop 3 while loop 4 do while loop 2 Introduction It is used when a statement or a block of
More informationAgenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures
The main body and cout Agenda 1 Fundamental data types Declarations and definitions Control structures References, pass-by-value vs pass-by-references The main body and cout 2 C++ IS AN OO EXTENSION OF
More informationA Freshman C++ Programming Course
A Freshman C++ Programming Course Dr. Ali H. Al-Saedi Al-Mustansiria University, Baghdad, Iraq January 2, 2018 1 Number Systems and Base Conversions Before studying any programming languages, students
More informationCHAPTER 4 CONTROL STRUCTURES
CHAPTER 4 CONTROL STRUCTURES 1 Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may deviate, repeat code or take decisions. For that purpose,
More informationI SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK a) What is the difference between Hardware and Software? Give one example for each.
I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK 70. a) What is the difference between Hardware and Software? Give one example for each. b) Give two differences between primary and secondary memory.
More informationIn this chapter you will learn:
1 In this chapter you will learn: Essentials of counter-controlled repetition. Use for, while and do while to execute statements in program repeatedly. Use nested control statements in your program. 2
More informationScore score < score < score < 65 Score < 50
What if we need to write a code segment to assign letter grades based on exam scores according to the following rules. Write this using if-only. How to use if-else correctly in this example? score Score
More informationCHAPTER 2.2 CONTROL STRUCTURES (ITERATION) Dr. Shady Yehia Elmashad
CHAPTER 2.2 CONTROL STRUCTURES (ITERATION) Dr. Shady Yehia Elmashad Outline 1. C++ Iterative Constructs 2. The for Repetition Structure 3. Examples Using the for Structure 4. The while Repetition Structure
More information1. a) What #include statement do you put at the top of a program that does uses cin, cout or endl?
Exercises with solutions. 1. a) What #include statement do you put at the top of a program that does uses cin, cout or endl? #include b) What using statement do you always put at the top of
More informationVOLUME II CHAPTER 9 INTRODUCTION TO C++ HANDS ON PRACTICE PROGRAMS
VOLUME II CHAPTER 9 INTRODUCTION TO C++ HANDS ON PRACTICE PROGRAMS 1. Write C++ programs to interchange the values of two variables. a. Using with third variable int n1, n2, temp; cout
More informationCHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM CHAPTER 9 C++
CHAPTER 9 C++ 1. WRITE ABOUT THE BINARY OPERATORS USED IN C++? ARITHMETIC OPERATORS: Arithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division etc.,
More informationProgramming - 1. Computer Science Department 011COMP-3 لغة البرمجة 1 لطالب كلية الحاسب اآللي ونظم المعلومات 011 عال- 3
Programming - 1 Computer Science Department 011COMP-3 لغة البرمجة 1 011 عال- 3 لطالب كلية الحاسب اآللي ونظم المعلومات 1 1.1 Machine Language A computer programming language which has binary instructions
More informationCSCE Practice Midterm. Data Types
CSCE 2004 - Practice Midterm This midterm exam was given in class several years ago. Work each of the following questions on your own. Once you are done, check your answers. For any questions whose answers
More informationBRAIN INTERNATIONAL SCHOOL. Term-I Class XI Sub: Computer Science Revision Worksheet
BRAIN INTERNATIONAL SCHOOL Term-I Class XI 2018-19 Sub: Computer Science Revision Worksheet Chapter-1. Computer Overview 1. Which electronic device invention brought revolution in earlier computers? 2.
More informationLESSON 3 CONTROL STRUCTURES
LESSON CONTROL STRUCTURES PROF. JOHN P. BAUGH PROFJPBAUGH@GMAIL.COM PROFJPBAUGH.COM CONTENTS INTRODUCTION... Assumptions.... Logic, Logical Operators, AND Relational Operators..... - Logical AND (&&) Truth
More informationSample Paper Class XI Subject Computer Sience UNIT TEST II
Sample Paper Class XI Subject Computer Sience UNIT TEST II (General OOP concept, Getting Started With C++, Data Handling and Programming Paradigm) TIME: 1.30 Hrs Max Marks: 40 ALL QUESTIONS ARE COMPULSURY.
More informationFunctions. Introduction :
Functions Introduction : To develop a large program effectively, it is divided into smaller pieces or modules called as functions. A function is defined by one or more statements to perform a task. In
More informationLab Instructor : Jean Lai
Lab Instructor : Jean Lai Group related statements to perform a specific task. Structure the program (No duplicate codes!) Must be declared before used. Can be invoked (called) as any number of times.
More informationReview: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements
Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja
More informationCSCE Practice Midterm. Data Types
CSCE 2004 - Practice Midterm This midterm exam was given in class several years ago. Work each of the following questions on your own. Once you are done, check your answers. For any questions whose answers
More informationChapter 17 - Notes Recursion
Chapter 17 - Notes Recursion I. Recursive Definitions A. Recursion: The process of solving a problem by reducing it to smaller versions of itself. B. Recursive Function: A function that calls itself. C.
More informationFunction with default arguments
Function with default arguments A function can be called without specifying all its arguments. This can be achieved only if the function declaration provides default values for those arguments that are
More informationMultiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)
Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program
More informationخ ث ح 13:10 14:00 خ ث ح 51:51 16:11 ر ن 09:41 11:11 ر ن
Philadelphia University Faculty of Engineering Department of Computer Engineering Programming Language (630263) Date:- 07/02/2015 Allowed time:- 2 Hours Final Exam Student Name: -... ID: - Instructor:
More informationBasic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable
Basic C++ Overview C++ is a version of the older C programming language. This is a language that is used for a wide variety of applications and which has a mature base of compilers and libraries. C++ is
More informationPhiladelphia University Faculty of Engineering Department of Computer Engineering Programming Language (630263)
Philadelphia University Faculty of Engineering Department of Computer Engineering Programming Language (63263) Date:- 6/5/25 Allowed time:- 5 minutes Second Exam Student Name: -... ID: - Instructors: Dr.
More information3/12/2018. Structures. Programming in C++ Sequential Branching Repeating. Loops (Repetition)
Structures Programming in C++ Sequential Branching Repeating Loops (Repetition) 2 1 Loops Repetition is referred to the ability of repeating a statement or a set of statements as many times this is necessary.
More informationIntroduction to C++ 2. A Simple C++ Program. A C++ program consists of: a set of data & function definitions, and the main function (or driver)
Introduction to C++ 1. General C++ is an Object oriented extension of C which was derived from B (BCPL) Developed by Bjarne Stroustrup (AT&T Bell Labs) in early 1980 s 2. A Simple C++ Program A C++ program
More informationExam I Review Questions Fall 2010
Exam I Review Questions Fall 2010 The following review questions are similar to the kinds of questions you will be expected to answer on Exam I (scheduled for Oct. 14), which will cover LCR, chs. 1 7,
More informationLab # 02. Basic Elements of C++ _ Part1
Lab # 02 Basic Elements of C++ _ Part1 Lab Objectives: After performing this lab, the students should be able to: Become familiar with the basic components of a C++ program, including functions, special
More informationSolution: A pointer is a variable that holds the address of another object (data item) rather than a value.
1. What is a pointer? A pointer is a variable that holds the address of another object (data item) rather than a value. 2. What is base address? The address of the nth element can be represented as (a+n-1)
More informationM1-R4: Programing and Problem Solving using C (JAN 2019)
M1-R4: Programing and Problem Solving using C (JAN 2019) Max Marks: 100 M1-R4-07-18 DURATION: 03 Hrs 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter
More informationControl Structure and Loop Statements
Control Structure and Loop Statements A C/C++ program executes in sequential order that is the way the instructions are written. There are situations when we have to skip certain code in the program and
More informationDELHI PUBLIC SCHOOL TAPI
Loops Chapter-1 There may be a situation, when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed
More informationFORM 1 (Please put your name and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each):
FORM 1 (Please put your name and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each): 1. The basic commands that a computer performs are input (get data), output (display result),
More information5. Assuming gooddata is a Boolean variable, the following two tests are logically equivalent. if (gooddata == false) if (!
FORM 2 (Please put your name and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each): 1. Assume that all variables are properly declared. The following for loop executes 20 times.
More informationASSIGNMENT CLASS-11 COMPUTER SCIENCE [C++]
ASSIGNMENT-1 2016-17 CLASS-11 COMPUTER SCIENCE [C++] 1 Consider the following C++ snippet: int x = 25000; int y = 2*x; cout
More informationExample 3. #include <iostream> using namespace std; int main()
1 Repetition Structure Examples Example 1 #include float number, sum=0; // number to be read cin >> number; // read first number cout
More informationAl-Albayt University Computer Science Department. C++ Programming 1 (901131) Coordinator: Dr. Ashraf Al-Ou n
Al-Albayt University Computer Science Department C++ Programming 1 (901131) Coordinator: Dr. Ashraf Al-Ou n 2019- الفصل الدرا ي س األول 2018 2 Subjects 1. Introduction to C++ Programming 2. Control Structures
More informationExamination for the Second Term - Academic Year H Mid-Term. Name of student: ID: Sr. No.
Kingdom of Saudi Arabia Ministry of Higher Education Course Code: ` 011-COMP Course Name: Programming language-1 Deanship of Preparatory Year Jazan University Total Marks: 20 Duration: 60 min Group: Examination
More informationFunctions. Arash Rafiey. September 26, 2017
September 26, 2017 are the basic building blocks of a C program. are the basic building blocks of a C program. A function can be defined as a set of instructions to perform a specific task. are the basic
More informationLaboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++
Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ 0.1 Introduction This is a session to familiarize working with the Visual Studio development environment. It
More informationCS242 COMPUTER PROGRAMMING
CS242 COMPUTER PROGRAMMING I.Safa a Alawneh Variables Outline 2 Data Type C++ Built-in Data Types o o o o bool Data Type char Data Type int Data Type Floating-Point Data Types Variable Declaration Initializing
More informationBRAIN INTERNATIONAL SCHOOL Term-II Class-XI Sub:- Computer Science Revision Sheet
BRAIN INTERNATIONAL SCHOOL Term-II Class-XI 2018-19 Computer Organisation Sub:- Computer Science Revision Sheet 1. Which electronic device invention brought revolution in earlier computers? 2. Which memory
More informationCreating a C++ Program
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer. 1 Creating a C++ Program created using an
More informationChapter 01 Arrays Prepared By: Dr. Murad Magableh 2013
Chapter 01 Arrays Prepared By: Dr. Murad Magableh 2013 One Dimensional Q1: Write a program that declares two arrays of integers and fills them from the user. Then exchanges their values and display the
More informationComputer Programming. Basic Control Flow - Loops. Adapted from C++ for Everyone and Big C++ by Cay Horstmann, John Wiley & Sons
Computer Programming Basic Control Flow - Loops Adapted from C++ for Everyone and Big C++ by Cay Horstmann, John Wiley & Sons Objectives To learn about the three types of loops: while for do To avoid infinite
More informationArray Part dimensional arrays - 2-dimensional array operations - Arrays of Strings - N-dimensional arrays
Array Array Part 1 - Accessing array - Array and loop arrays must be used with loops - Array and bound checking Be careful of array bound: invalid subscripts => corrupt memory; cause bugs - Array initialization
More informationA First Program - Greeting.cpp
C++ Basics A First Program - Greeting.cpp Preprocessor directives Function named main() indicates start of program // Program: Display greetings #include using namespace std; int main() { cout
More information#include <iostream> #include <algorithm> #include <cmath> using namespace std; int f1(int x, int y) { return (double)(x/y); }
1. (9 pts) Show what will be output by the cout s in this program. As in normal program execution, any update to a variable should affect the next statement. (Note: boolalpha simply causes Booleans to
More informationn Group of statements that are executed repeatedly while some condition remains true
Looping 1 Loops n Group of statements that are executed repeatedly while some condition remains true n Each execution of the group of statements is called an iteration of the loop 2 Example counter 1,
More informationFORM 1 (Please put your name and section number (001/10am or 002/2pm) on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each):
FORM 1 (Please put your name and section number (001/10am or 002/2pm) on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each): 1. If a function has default arguments, they can be located anywhere
More informationThe following expression causes a divide by zero error:
Chapter 2 - Test Questions These test questions are true-false, fill in the blank, multiple choice, and free form questions that may require code. The multiple choice questions may have more than one correct
More informationSBOA SCHOOL & JUNIOR COLLEGE, CHENNAI 101 COMPUTER SCIENCE CLASS: XI HALF YEARLY EXAMINATION MAX MARKS:70 CODE - A DURATION : 3 Hours
SBOA SCHOOL & JUNIOR COLLEGE, CHENNAI 101 COMPUTER SCIENCE CLASS: XI HALF YEARLY EXAMINATION 2016 MAX MARKS:70 CODE - A DURATION : 3 Hours All questions are compulsory. Do not change the order of the questions
More informationSol. Sol. a. void remove_items_less_than(int arr[], int size, int value) #include <iostream> #include <ctime> using namespace std;
r6.14 For the operations on partially filled arrays below, provide the header of a func tion. d. Remove all elements that are less than a given value. Sol a. void remove_items_less_than(int arr[], int
More informationKingdom of Saudi Arabia Princes Nora bint Abdul Rahman University College of Computer Since and Information System CS240 BRANCHING STATEMENTS
Kingdom of Saudi Arabia Princes Nora bint Abdul Rahman University College of Computer Since and Information System CS240 BRANCHING STATEMENTS Objectives By the end of this section you should be able to:
More informationChapter 3 Problem Solving and the Computer
Chapter 3 Problem Solving and the Computer An algorithm is a step-by-step operations that the CPU must execute in order to solve a problem, or to perform that task. A program is the specification of an
More informationBasic Source Character Set for C++ Language:
Lecture 4 1. Programming in C++ Language: C++ was created by Bjarne Stroustrup, beginning in 1979. The development and refinement of C++ was a major effort, spanning the 1980s and most of the 1990s. Finally,
More informationDHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++
DHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++ Objective: To Learn Basic input, output, and procedural part of C++. C++ Object-orientated programming language
More informationLESSON 2 VARIABLES, OPERATORS, EXPRESSIONS, AND USER INPUT
LESSON VARIABLES, OPERATORS, EXPRESSIONS, AND USER INPUT PROF. JOHN P. BAUGH PROFJPBAUGH@GMAIL.COM PROFJPBAUGH.COM CONTENTS INTRODUCTION... Assumptions.... Variables and Data Types..... Numeric Data Types:
More informationC: How to Program. Week /Mar/05
1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers
More informationReview Questions for Final Exam
CS 102 / ECE 206 Spring 11 Review Questions for Final Exam The following review questions are similar to the kinds of questions you will be expected to answer on the Final Exam, which will cover LCR, chs.
More informationSample Paper - II Subject Computer Science
Sample Paper - II Subject Computer Science Max Marks 70 Duration 3 hrs Note:- All questions are compulsory Q1) a) What is significance of My Computer? 2 b) Explain different types of operating systems.
More informationEAS 230 Fall 2002 Section B
EAS 230 Fall 2002 Section B Exam #2 Name: Person Number: Instructions: ƒ Total points are 100, distributed as shown by [ ]. ƒ Duration of the Exam is 50 minutes. I ) State whether True or False [25] Indicate
More information6.096 Introduction to C++ January (IAP) 2009
MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture
More informationCMSC 202 Midterm Exam 1 Fall 2015
1. (15 points) There are six logic or syntax errors in the following program; find five of them. Circle each of the five errors you find and write the line number and correction in the space provided below.
More informationC++ is case sensitive language, meaning that the variable first_value, First_Value or FIRST_VALUE will be treated as different.
C++ Character Set a-z, A-Z, 0-9, and underscore ( _ ) C++ is case sensitive language, meaning that the variable first_value, First_Value or FIRST_VALUE will be treated as different. Identifier and Keywords:
More informationData Structures Lab II. Binary Search Tree implementation
Data Structures Lab II Binary Search Tree implementation Objectives: Making students able to understand basic concepts relating to Binary Search Tree (BST). Making students able to implement Binary Search
More informationLecture 2:- Functions. Introduction
Lecture 2:- Functions Introduction A function groups a number of program statements into a unit and gives it a name. This unit can then be invoked from other parts of the program. The most important reason
More informationDept. of CSE, IIT KGP
Control Flow: Looping CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Types of Repeated Execution Loop: Group of
More informationCSCE121: Introduction to Program Design and Concepts Practice Questions for Midterm 3
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING CSCE121: Introduction to Program Design and Concepts Practice Questions for Midterm 3 March 27, 2019 Question 1: Printing a histogram of letters Question 2:
More informationObjectives. In this chapter, you will:
Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about
More informationBy the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program
1 By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program variables. Apply C++ syntax rules to declare variables, initialize
More informationThe C++ Language. Arizona State University 1
The C++ Language CSE100 Principles of Programming with C++ (based off Chapter 2 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University
More informationCAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE
CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE a) Mention any 4 characteristic of the object car. Ans name, colour, model number, engine state, power b) What
More informationTotal 100. The American University in Cairo Computer Science & Engineering Department CSCE Instructor: Final Exam Fall 2014
The American University in Cairo Computer Science & Engineering Department CSCE 1001 Instructor: Final Exam Fall 2014 Last Name :... ID:... First Name:... Form I- Section No. ( ) EXAMINATION INSTRUCTIONS
More informationMultiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)
Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program
More information1st Midterm Exam: Solution COEN 243: Programming Methodology I
1st Midterm Exam: Solution COEN 243: Programming Methodology I Aishy Amer, Concordia University, Electrical and Computer Engineering February 10, 2005 Instructions: 1. Time Allowed is 1 Hour. Total Marks
More informationChapter 4 - Notes Control Structures I (Selection)
Chapter 4 - Notes Control Structures I (Selection) I. Control Structures A. Three Ways to Process a Program 1. In Sequence: Starts at the beginning and follows the statements in order 2. Selectively (by
More informationUsing Parallel Arrays. Parallel Array Example
Using Parallel Arrays Parallel arrays: two or more arrays that contain related data A subscript is used to relate arrays: elements at same subscript are related Arrays may be of different types Parallel
More informationINTRODUCTION TO PROGRAMMING
FIRST SEMESTER INTRODUCTION TO PROGRAMMING COMPUTER SIMULATION LAB DEPARTMENT OF ELECTRICAL ENGINEERING Prepared By: Checked By: Approved By Engr. Najeeb Saif Engr. M.Nasim Kha Dr.Noman Jafri Lecturer
More informationC++ Final Exam 2017/2018
1) All of the following are examples of integral data types EXCEPT. o A Double o B Char o C Short o D Int 2) After the execution of the following code, what will be the value of numb if the input value
More informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
More informationOther operators. Some times a simple comparison is not enough to determine if our criteria has been met.
Lecture 6 Other operators Some times a simple comparison is not enough to determine if our criteria has been met. For example: (and operation) If a person wants to login to bank account, the user name
More informationArrays and functions Multidimensional arrays Sorting and algorithm efficiency
Introduction Fundamentals Declaring arrays Indexing arrays Initializing arrays Arrays and functions Multidimensional arrays Sorting and algorithm efficiency An array is a sequence of values of the same
More informationADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1
NAGERCOIL COMPUTER SCIENCE Grade: IX C++ PROGRAMMING 1 C++ 1. Object Oriented Programming OOP is Object Oriented Programming. It was developed to overcome the flaws of the procedural approach to programming.
More informationDo not turn to the next page until the start of the exam.
Introduction to Programming, PIC10A E. Ryu Fall 2017 Midterm Exam Friday, November 3, 2017 50 minutes, 11 questions, 100 points, 8 pages While we don t expect you will need more space than provided, you
More informationCPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points)
Name Definition Matching (8 Points) 1. (8 pts) Match the words with their definitions. Choose the best definition for each word. Relational Expression Iteration Counter Count-controlled loop Loop Flow
More informationCHAPTER 4 FUNCTIONS. Dr. Shady Yehia Elmashad
CHAPTER 4 FUNCTIONS Dr. Shady Yehia Elmashad Outline 1. Introduction 2. Program Components in C++ 3. Math Library Functions 4. Functions 5. Function Definitions 6. Function Prototypes 7. Header Files 8.
More informationGetting started with C++ (Part 2)
Getting started with C++ (Part 2) CS427: Elements of Software Engineering Lecture 2.2 11am, 16 Jan 2012 CS427 Getting started with C++ (Part 2) 1/22 Outline 1 Recall from last week... 2 Recall: Output
More informationMultiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)
Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program
More informationIntroduction to Programming
Introduction to Programming session 6 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Spring 2011 These slides are created using Deitel s slides Sharif University of Technology Outlines
More informationCSE030 Fall 2012 Final Exam Friday, December 14, PM
CSE030 Fall 2012 Final Exam Friday, December 14, 2012 3-6PM Write your name here and at the top of each page! Name: Select your lab session: Tuesdays Thursdays Paper. If you have any questions or need
More informationBSc (Hons) Computer Science. with Network Security. Examinations for / Semester1
BSc (Hons) Computer Science with Network Security Cohort: BCNS/15B/FT Examinations for 2015-2016 / Semester1 MODULE: PROGRAMMING CONCEPT MODULE CODE: PROG 1115C Duration: 3 Hours Instructions to Candidates:
More informationCS Data Structure Spring Answer Key- Assignment #2
CS300-201 Data Structure Spring 2012 2013 Answer Key- Assignment #2 Due Sunday, Feb 17th. Q1): For each of the following five program fragments: a. Give an analysis of the running time (Big-Oh will do).
More informationGE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004
GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004 Functions and Program Structure Today we will be learning about functions. You should already have an idea of their uses. Cout
More informationPOINTERS. Pointer is a memory variable which can store address of an object of specified data type. For example:
POINTERS Pointer is a memory variable which can store address of an object of specified data type For example: #include int x=5; int *a;//here a is a pointer to int which can store address of
More information