Скачать презентацию Knew IT Центр карьеры Курс С Лекция Скачать презентацию Knew IT Центр карьеры Курс С Лекция

C++_Lecture_1.pptx

  • Количество слайдов: 9

Knew IT Центр карьеры Курс С++ Лекция № 1 Бекаулов Нурбек Knew IT Центр карьеры Курс С++ Лекция № 1 Бекаулов Нурбек

Input & Output Input & Output

If(Условия) { Действия} else { дефолтовое } • #include <iostream> • using namespace std; If(Условия) { Действия} else { дефолтовое } • #include • using namespace std; • int main(){ • • int num 1; int num 2; • cin>>num 1>>num 2>>endl; • • • if( num 1 == num 2 ) cout<< num 1 << " is equal to "<< num 2 << endl; • • • • if( num 1 < num 2 ) cout<< num 1 << " is less than "<< num 2 << endl; if( num 1 != num 2 ) cout<< num 1 << " is not equal to "<< num 2 << endl; if( num 1 > num 2 ) cout<< num 1 << " is greater than "<< num 2 << endl; if( num 1 <= num 2 ) cout<< num 1 << " is less than or equal to "<< num 2 << endl; if( num 1 >= num 2 ) cout<< num 1 <<" is greater than or equal to "<< num 2 << endl; return 0; }

Логические операторы && (И) || (ИЛИ) ! (НЕТ) if ( gender == 1 && Логические операторы && (И) || (ИЛИ) ! (НЕТ) if ( gender == 1 && age >= 65 ) if ( semester. Average >= 90 || final. Exam >= 90 ) cout << "Student grade is A" << endl; if ( !( grade == sentinel. Value ) ) cout << "The next grade is " << grade << endl; if ( grade != sentinel. Value ) cout << "The next grade is " << grade << endl;

Работа с IF/Else if ( grade >= 90 ) // 90 and above cout Работа с IF/Else if ( grade >= 90 ) // 90 and above cout << "A"; else if ( grade >= 80 ) // 80 -89 cout << "B"; else if ( grade >= 70 ) // 70 -79 cout << "C"; else if ( grade >= 60 ) // 60 -69 cout << "D"; else // less than 60 cout << "F";

Работа с While – это цикл который будет повторятся пока не докажет что функция Работа с While – это цикл который будет повторятся пока не докажет что функция True/False Пример: While (Условия){ Выполнения каких либо действий пока не достигнет True/False }

Пример While : #include <iostream> using namespace std; int main(){ int total; int grade. Пример While : #include using namespace std; int main(){ int total; int grade. Counter; int grade; int average; total = 0; grade. Counter = 1; while(grade. Counter <=10){ cout<< "Введите оценку"; cin>> grade; total = total + grade; grade. Counter = grade. Counter + 1; } average = total/10; cout<<"Среднее значение" <

Еще один пример Еще один пример

Всем спасибо!!! Если у кого то есть вопросы задавайте Всем спасибо!!! Если у кого то есть вопросы задавайте