*   >> Lezen Onderwijs artikelen >> education >> college and university

Module 6: Inleiding tot C en C ++

Module 6

---------------------------- --------------------- #include //voor het systeem () # include ... {C ++ code ...} --------- ---------------------------------------- moet worden gewijzigd in: ----- -------------------------------------------- #include //gebruik C ++ wrapper voor C functies aanroepen van C ++ programma's ... #include using namespace std; ... {C ++ code ...} ---------------------------------------- --------- In VC ++ /VC ++ .Net de iostream.h (kopbal met .h) is niet meer geldig. Het moet C ++ header zijn, zodat het voldoet aan de standaard.

In oudere Borland C ++ compiler dit werkt nog steeds, maar niet goed meer ... en voor de standaard C /C ++ de overdraagbaarheid geen probleem moeten zijn of beter je Module23 lezen op https://www.tenouk.com/Module23.html te krijgen het grote beeld ... Voor C-codes, ze nog steeds C-codes: o) ================================= ======================================== ========== ================================================== ============= #include int main () {float rate = 5.0; int uur = 25; float pay = (float) uur * tarief; printf ("\\ Npay = $% 2F.

\\ n", pay); 0 terug; } ------------------------------------------------- -------------------------------------------------- //dienovereenkomstig chnage de header-bestanden voor andere C ++ voorbeelden ... //# bevatten //# bevatten //using namespace std; #include #include int main () {int job_code; dubbele housing_allowance, entertainment_allowance, car_allowance; cout cin >> job_code; //Als 1 wordt geselecteerd als (job_code == 1) {car_allowance = 200,00; housing_allowance = 800,00; entertainment_allowance = 250,00; cout cout //andere dan 1 else {car_allowance = 100,00; housing_allowance = 400,00; entertainment_allowance = 150,00; cout cout systeem ("pauze"); 0 terug; } ------------------------------------------------- -------------------------------------------- #include #include int main () {char job_title; int years_served, no_of_pub; cout cout cin >> job_title; cout cin >> years_served; cout cin >> no_of_pub; if (job_title == 'T') {if (years_served> 15) als (no_of_pub> 10) cout anders cout anders cout} else if (job_title == 'L') {if (years_served> 10) als (no_of_pub> 5 ) cout anders cout anders cout} else if (job_title == 'A') {if (years_served> 5) als (no_of_pub> 5) cout anders cout anders cout} cout systeem ("pauze"); 0 terug; } ------------------------------------------------- ------------------------------------ #include #include int main () {int merk; cout cin >> merk; if (mark cout anders als (merk cout anders als (merk cout anders als (merk cout anders als (merk cout anders cout cout systeem ("pauze"); return 0;} ------------ -------------------------------------------------- ------------------------ //Programma voorbeeld van if-else statement.

Dit programma //is om te testen of een bank transactie is een borg, //terugtrekking, overdracht of een ongeldige transactie, //en de nodige maatregelen te #include #include int main () {float bedrag te nemen;. char transaction_code; cout cout cin >> transaction_code; if (transaction_code == 'D') { cout cout cin >> bedrag; cout cout} else if (transaction_code == 'W') {cout cout cin >> bedrag; cout cout} else if (transaction_code == 'T') {cout cout cin >> bedrag; cout cout} else {cout cout cout} cout systeem ("pauze"); return 0;} ------------------------------ -------------------------------------------------- - //Sample programma Menu selectie #include #include int main () {char selectie; cout cout cout cout cout cout cout cin >>

Page   <<       [1] [2] [3] [4] [5] [6] [7] [8] >>
Copyright © 2008 - 2016 Lezen Onderwijs artikelen,https://onderwijs.nmjjxx.com All rights reserved.