Programming In C++ Spring Semester 2013 Practice 1-3 Lectures Programming In C++, Lecture 3 By Umer Rana.

Slides:



Advertisements
Similar presentations
#include void main() { float x = 1.66, y = 1.75; printf(%f%f,ceil(x), floor(y)); }
Advertisements

Character Arrays (Single-Dimensional Arrays) A char data type is needed to hold a single character. To store a string we have to use a single-dimensional.
1 Applets Programming Enabling Application Delivery Via the Web.
1 March 2013Birkbeck College, U. London1 Introduction to Programming Lecturer: Steve Maybank Department of Computer Science and Information Systems
Chapter 7: Arrays In this chapter, you will learn about
Programming In C++ Spring Semester 2013 Lecture 11 Programming In C++, Lecture 11 By Umer Rana.
Programming In C++ Spring Semester 2013 Lecture 12 Programming In C++, Lecture 12 By Umer Rana.
Programming In C++ Spring Semester 2013 Practice 2 Programming In C++, Practice By Umer Rana.
Programming In C++ Spring Semester 2013 Lecture 3 Programming In C++, Lecture 3 By Umer Rana.
Lecture 9: Character and String
Programming In C++ Spring Semester 2013 Lecture 6 Programming In C++, Lecture 6 By Umer Rana.
Spring Semester 2013 Lecture 5
Programming In C++ Spring Semester 2013 Lecture 4 Programming In C++, Lecture 3 By Umer Rana.
Computer Programming Lab(7).
Programming In C++ Spring Semester 2013 Lecture 13 Programming In C++, Lecture 13 By Umer Rana.
Java Math Class. What is the Math Class? The Math Class is another class that is prepared by Java for us to use We use this class for mathematical operations.
COMPSCI 210 Semester Tutorial 10 Exercises from CH 14.
Representing an algorithm using Flowcharts
Chapter 6 Advanced Function Features Pass by Value Pass by Reference Const parameters Overloaded functions.
void count_down (int count) { for(i=count; i>1; i--) printf(" %d\t", count); } printf("A%d\n", count); if(count>1) count_down(count-1); printf("B%d\n",
BBS Yapısal Programlama (Structured Programming)
Making Choices in C if/else statement logical operators break and continue statements switch statement the conditional operator.
C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
 2000 Prentice Hall, Inc. All rights reserved Fundamentals of Strings and Characters String declarations –Declare as a character array or a variable.
Sort the given string, without using string handling functions.
Programming In C++ Spring Semester 2013 Lecture 8 Programming In C++, Lecture 8 By Umer Rana.
Lab 8 User Defined Function.
Exercise 4 1. Write a program that simulates coin tossing. For each toss of the coin the program should print Heads or Tails. Let the program toss the.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Basic C Programming Data Types and Arithmetic Operations 01/30/15.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 6P. 1Winter Quarter I/O in C Lecture 6.
Basic Input/Output and Variables Ethan Cerami New York
C - Input & Output When we are saying Input that means to feed some data into program. This can be given in the form of file or from command line. C programming.
1 CSC103: Introduction to Computer and Programming Lecture No 30.
First Program in C With Output. C Language Keywords.
Algorithms and Computing Lecture 3 Control Statements By Dr. M. Tahir Khaleeq.
Recursion Examples Fundamentals of CS Case 1: Code /* Recursion: Case 1 */ #include void count (int index); main () { count (0); getchar(); } void count.
POINTERS. 1.a) POINTER EXPRESSIONS Pointer variables can be used in expression If p1 and p2 are properly declared and initialized pointers then following.
CP104 Introduction to Programming File I/O Lecture 33 __ 1 File Input/Output Text file and binary files File Input/output File input / output functions.
Nested LOOPS.
CHAPTER 7 DATA INPUT OUTPUT Prepared by: Lec. Ghader R. Kurdi.
Characters. Character Data char data type – Represents one character – char literals indicated with ' '
PHYS 2020 Basic C An introduction to writing simple but useful programs in C In these lectures I will take you through the basics of C, but you will need.
Ch Chapter 4 Basic Data Types and Variables 4.1 Basic Data Types In C TABLE 4.1 Introduction to Basic Data Types in C Type SizeDescription char 1.
Introduction to Computing Concepts Note Set 12. Writing a Program from Scratch public class SampleProgram1 { public static void main (String [] args)
Computer Programming Control Structure
Java Programming, Second Edition Chapter Two Using Data Within a Program.
Exercise 1 Introduction to C# CIS Code the C# program to prompt the user to key in 12 integer values from the keyboard. If a value containing.
Escape sequence Certain characters, preceded by a backslash ( \ ), are known as escape sequences They are used to display certain characters, or as display.
C Building Block Chapter 2. Variables A variable is a space in the computer’s memory set aside for a certain kind of data and given a name for easy reference.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
13/15/2016CS150 Introduction to Computer Science 1 Summary  Assignment due on Wednesday, October 29,  Tutor will be in the lab on Tuesday evening,
1 C Syntax and Semantics Dr. Sherif Mohamed Tawfik Lecture Two.
Intro. to Computer Programming Eng. Nehal A. Mohamed Spring Semester-2016.
Data Types and Input Output in C. Size of a Character in C #include int main() { char ch; ch = 'A'; printf("ch = %c\n",ch); printf("size of char = %d.
CCSA 221 Programming in C CHAPTER 3 COMPILING AND RUNNING YOUR FIRST PROGRAM 1 ALHANOUF ALAMR.
C++ CODES PART#04 1 COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT.
REEM ALAMER REVISION FOR C LANGUAGE COURSE. OUTPUTS int main (void) { int C1, C2; int *p1, *p2; C1 = 8; p1 = &C1; C2 = *p1 / 2 + 5; p2 = &C2; printf ("C1.
Enum ,Char Functions& Math Library Functions I.Mona Alshehri
Lecture2.
By: Syed Shahrukh Haider
OUTPUT STATEMENTS GC 201.
توابع ورودي-خروجي.
Lecture 8b: Strings BJ Furman 15OCT2012.
CSC215 Homework Homework 04 Due date: Oct 14, 2016.
Suppose I want to add all the even integers from 1 to 100 (inclusive)
CS150 Introduction to Computer Science 1
CSCE 206 Lab Structured Programming in C
CSCE 206 Lab Structured Programming in C
Introduction to Programming
Presentation transcript:

Programming In C++ Spring Semester 2013 Practice 1-3 Lectures Programming In C++, Lecture 3 By Umer Rana

Practice-1 n Write a program to print you name, Class & group. Programming In C++, Lecture 3 By Umer Rana

Practice-1 # include Void main () { printf (“My name is Ali \n”); printf (“My Class is BSCS \n”); printf (“My Group is B \n”); getche(); } Programming In C++, Lecture 3 By Umer Rana

Practice-2 n Write a program to show sum of two integer number 10 & 20. Programming In C++, Lecture 3 By Umer Rana

Practice-2 # include Void main () { int num1=10,num2=20,sum; sum=num1+num2; printf(“Sum of integers is %d”,sum); getche(); } Programming In C++, Lecture 3 By Umer Rana

Practice-3 n Write a program that will demonstrate the use of escape sequences Output NameRollNoMarks Amir78425 Tahir22389 Programming In C++, Lecture 3 By Umer Rana

Practice-3 # include Void main () { printf(“Name \t\t Roll No\t\t Marks\n”); printf(“Amir \t\t 78 \t\t 425\n”); printf(“Tahir \t\t 22 \t\t 389\n”); getche(); } Programming In C++, Lecture 3 By Umer Rana

Practice-4 n Write a program that displays the ASCII code of the character typed by user. Programming In C++, Lecture 3 By Umer Rana

Practice-4 # include Void main () { char ch; ch=getche(); printf(“\n The ASCII code for %C is %d”,ch,ch); getche(); } Programming In C++, Lecture 3 By Umer Rana

Practice-5 n Write a program to print digits from 1 to 10 Programming In C++, Lecture 3 By Umer Rana

Practice-5 # include Void main () { int count; for(count=1; count<=10;count++) printf(“%d\n”,count); getche(); } Programming In C++, Lecture 3 By Umer Rana # include Void main () { int count=1; while(count<=10) { printf(“%d\n”,count); count=count+1; } getche(); }

Practice-6 n Write a program that will print asterisks (*) according to the pattern shown in: ******* ****** ***** **** *** ** * Programming In C++, Lecture 3 By Umer Rana

Practice-6 # include Void main () { int inner, outer; for(outer=7; outer=>1;outer--) { inner=1; while(inner<+outer) { printf(“*”); inner++ } printf(“\n”); } getche(); } Programming In C++, Lecture 3 By Umer Rana

Practice-6 # include Void main () { int inner, outer; for(outer=7; outer=>1;outer--) { inner=1; while(inner<+outer) { printf(“*”); inner++ } printf(“\n”); } getche(); } Programming In C++, Lecture 3 By Umer Rana

Practice-7 n Write a program that will print asterisks (*) according to the pattern shown in: –Re-write by replacing the inner while loop with »For loop »do- while loop –Re-write by replacing the outer for loop with »While loop »do- while loop Programming In C++, Lecture 3 By Umer Rana