SlideShare a Scribd company logo
1 of 10
‫ی‬‫کامپیوتر‬‫ی‬‫ساز‬‫نامه‬‫ر‬‫ب‬
‫دانشکده‬
:
‫مهندسی‬‫و‬‫فنی‬
‫بخش‬
‫دوم‬
:
‫نامه‬‫ر‬‫ب‬‫یک‬‫نده‬‫ز‬‫سا‬‫ای‬‫ز‬‫اج‬‫با‬‫ی‬‫شنای‬‫ا‬
C
‫مدرس‬
:
‫ی‬‫دسر‬‫و‬‫ر‬‫نیا‬‫مهدی‬‫حسین‬‫تر‬‫دک‬
Available
Online
in:
www.mahdinia.com
1
‫در‬‫کد‬‫یک‬‫بخشهای‬
Code::Blocks
Available
Online
in:
www.mahdinia.com
2
‫نده‬‫ز‬‫پردا‬‫پیش‬
(
Pre-Processor
)
‫ودی‬‫ر‬‫و‬ ‫استاندارد‬‫توابع‬
-
‫جی‬‫و‬‫خر‬
(Standard I/O Header)
‫اصلی‬‫تابع‬
(
Main Function
)
‫ات‬‫ر‬‫دستو‬‫نوشتن‬‫محل‬
(
‫شده‬‫فرمت‬‫ینت‬‫ر‬‫پ‬
printf:
)
‫تابع‬‫نتیجه‬
(
‫تابع‬‫اگر‬
main
‫شود‬‫ا‬‫ر‬‫اج‬‫درستی‬‫به‬
0
‫گرداند‬‫برمی‬
)
‫لی‬‫ر‬‫کنت‬ ‫تر‬‫اک‬‫ر‬‫کا‬
Escape Sequence
‫لی‬‫ر‬‫کنت‬‫ترهای‬‫اک‬‫ر‬‫کا‬
(
Escape Sequence
)
•
‫در‬‫استفاده‬ ‫د‬‫ر‬‫مو‬‫لی‬‫ر‬‫کنت‬‫ترهای‬‫اک‬‫ر‬‫کا‬
C
:
• n ‫جدید‬‫خط‬
• t Tab ‫تر‬‫اک‬‫ر‬‫کا‬
• a Beep ‫صدای‬‫ایجاد‬
•  Backslash ‫تر‬‫اک‬‫ر‬‫کا‬‫ایجاد‬
• ” Double Quotation Mark ‫تر‬‫اک‬‫ر‬‫کا‬‫ایجاد‬
•
‫در‬‫لی‬‫ر‬‫کنت‬ ‫ترهای‬‫اک‬‫ر‬‫کا‬‫سایر‬
:
https://en.wikipedia.org/wiki/Escape_sequences_in_C
Available
Online
in:
www.mahdinia.com
3
‫ودی‬‫ر‬‫و‬‫توابع‬ ‫عملکرد‬‫از‬ ‫ساده‬‫مثالهای‬
-
‫جی‬‫و‬‫خر‬
•
‫جی‬‫و‬‫خر‬‫در‬‫ن‬‫ا‬‫نوشتن‬‫و‬‫ی‬‫دانشجوی‬‫شماره‬ ‫گرفتن‬
•
‫نها‬‫ا‬‫کردن‬ ‫جمع‬‫و‬ ‫عدد‬‫دو‬‫گرفتن‬
•
‫اصلی‬‫اعمال‬‫سایر‬‫اعمال‬
(
‫تقسیم‬‫و‬‫ضرب‬،‫یق‬‫ر‬‫تف‬
)
‫عدد‬‫دو‬‫ی‬‫و‬‫ر‬
•
‫عدد‬‫دو‬‫تقسیم‬‫باقیمانده‬
Available
Online
in:
www.mahdinia.com
4
‫توابع‬‫و‬‫متغیرها‬ ‫ی‬‫نامگذار‬‫مالحظات‬
•
‫و‬‫داد‬ ‫اع‬،‫ک‬ ‫کو‬، ‫ر‬‫ز‬ ‫ب‬‫و‬‫و‬‫ر‬ ‫ح‬‫امل‬ ‫ش‬‫د‬ ‫بای‬‫ط‬ ‫فق‬
‘_’
(
Underscore
or
Underline
)
‫باشند‬
.
•
‫یا‬‫و‬‫و‬‫حر‬‫با‬
_
‫شود‬‫ع‬‫و‬‫شر‬
.
•
‫ود‬‫ش‬‫می‬‫ع‬‫و‬‫ر‬‫ش‬‫ک‬ ‫کو‬‫و‬‫و‬‫ر‬‫ح‬‫ا‬‫ب‬‫ا‬‫متغیره‬‫و‬‫ع‬‫تواب‬‫م‬‫اس‬‫وا‬‫معم‬
(
‫ت‬‫نیس‬‫ی‬‫ار‬‫اجب‬
.)
‫ام‬‫ن‬
‫ای‬‫ه‬
‫مانند‬‫مجاز‬
:
• A a b32 _myfunc
•
‫مانند‬ ‫مجاز‬‫غیر‬ ‫نامهای‬
:
• 32 64B
•
‫کنیم‬‫استفاده‬‫کوتاه‬ ‫اسامی‬‫از‬‫کنیم‬‫سعی‬
.
‫بلند‬‫اسامی‬‫در‬
:
• std_number stdNumber shebaCreator
Available
Online
in:
www.mahdinia.com
5
‫متغیرها‬‫یف‬‫ر‬‫تع‬
int a = 10;
•
‫دهد‬‫می‬‫تشکیل‬‫ا‬‫ر‬‫متغیر‬‫یک‬‫فوق‬‫اساسی‬‫ویژگی‬ ‫سه‬
.
•
‫کنیم‬‫می‬‫صحبت‬‫نها‬‫ا‬‫از‬‫استفاده‬‫نحوه‬‫و‬ ‫متغیرها‬‫انواع‬ ‫د‬‫ر‬‫مو‬‫در‬‫بعد‬‫جلسات‬‫در‬
.
Available
Online
in:
www.mahdinia.com
6
‫متغیر‬‫نوع‬
(
Type
)
‫متغیر‬‫نام‬
(
Name
)
‫متغیر‬ ‫مقدار‬
(
Value
)
‫یاضی‬‫ر‬‫اصلی‬‫اعمال‬
• + ‫جمع‬
• - ‫ق‬‫تفر‬
• * ‫ضرب‬
• / ‫تقسیم‬
• % ‫تقسیم‬‫باقیمانده‬
• () ‫انتز‬‫ر‬‫پ‬
•
‫بان‬‫ز‬
C
‫ندارد‬ ‫مستقیم‬‫ت‬‫ر‬‫صو‬‫به‬‫اعداد‬ ‫رساندن‬‫توان‬‫به‬‫ای‬‫ر‬‫ب‬ ‫ی‬‫عملگر‬
.
•
‫در‬ ‫عملگرها‬‫کلیه‬‫لیست‬
:
https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B
Available
Online
in:
www.mahdinia.com
7
‫یاضی‬‫ر‬‫عملیات‬‫ای‬‫ر‬‫اج‬‫تیب‬‫ر‬‫ت‬
• c = a / a – b;
• c = a / (a – b);
•
‫عملیات‬ ‫تیب‬‫ر‬‫ت‬
:
–
)(
–
% / *
–
-
+
Available
Online
in:
www.mahdinia.com
8
10
2
10 5
a
c
a b
  
 
‫اشتباه‬
(
‫ن‬‫ا‬‫حاصل‬
1-b
‫شود‬‫می‬
)
‫صحیح‬
(
‫ن‬‫ا‬ ‫حاصل‬
2
‫شود‬‫می‬
)
‫در‬ ‫و‬‫ر‬‫ز‬‫ر‬‫کلمات‬
C
(
Keywords
)
•auto
•break
•case
•char
•const
•continue
•default
•do
•double
•else
•enum
•extern
•float
•for
•goto
•if
•int
•long
•register
•return
•short
•signed
•sizeof
•static
•struct
•switch
•typedef
•union
•unsigned
•void
•volatile
•while
Available
Online
in:
www.mahdinia.com
9
•
‫های‬‫نامه‬‫ر‬‫ب‬‫کلیه‬
C
‫این‬‫با‬
32
‫شوند‬ ‫می‬‫نوشته‬‫کلمه‬
(
‫استاندارد‬ ‫طبق‬
C89
.)
•
‫کرد‬ ‫استفاده‬‫توابع‬‫و‬ ‫متغیرها‬ ‫ی‬‫نامگذار‬‫ای‬‫ر‬‫ب‬‫نها‬‫ا‬‫از‬‫توان‬‫نمی‬
.
•
‫ش‬‫نمی‬‫توصیه‬‫اما‬،‫نیست‬ ‫مشکلی‬‫شود‬‫استفاده‬‫نها‬‫ا‬ ‫ر‬‫بز‬‫و‬‫و‬‫حر‬‫از‬‫ر‬‫اگ‬ ‫البته‬
‫ود‬
!
‫در‬ ‫و‬‫ر‬‫ز‬‫ر‬‫کلمات‬
C
(
Keywords
)
Available
Online
in:
www.mahdinia.com
10
•
Keyword
‫در‬‫شده‬‫اضافه‬‫های‬
‫استاندارد‬
C99
:
•
Keyword
‫استاندارد‬‫در‬‫شده‬‫اضافه‬‫های‬
C11
:
•_Bool
•_Complex
•_Imaginary
•inline
•_Alignas
•_Alignof
•_Atomic
•_Generic
•_Noreturn
•_Static_assert

More Related Content

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

CPP_Chapter 02_C Code- Main Sections.pptx