Computer General/C++ development from the beginning 썸네일형 리스트형 File Input/Output #include #include //need to include this(stream textfile in and out) using namespace std; int main() { ofstream myfile; //create an object that allows outputfiles to create file myfile.open("newfile.txt"); //it would create a file for you if not exists... myfile >word; //get the value while(bucky.good()){ // good => as long as it's not eof cout Structures #include #include struct newperson { //members(all of bits of information) //person's name char name[20]; int age; }; int main() { using namespace std; //1. declaration of newperson newperson bucky = { "Bucky", 21 }; //then how can we use? cout Switch statement Switch : it's like if and else if statement, but it is a lot more organized to work with and read int main() { using namespace std; int x; cout Logical OR operator OR : one of those options is true, then the whole statement is true. (||) #include #include int main() { using namespace std; cout The if Statement If : give the program an option#include int main(){using namespace std;int var = 16;if (var < 30) //if it's false not gonna run the statement{cout Address Operator & Pointer Address Operator : it shows where in the memory the variable is stored #include int main(){using namespace std;int f = 10; //make variablesint e = 2;//output on the screen?cout Beginning Loop repetitive task ----> use loop!#include int main(){using namespace std;int x;for(x=0;x Beginning Arrays Array is a variable that holds a bunch of values in it.(multiple values saved in a single variable)Simple! and Useful! #include #include int main(){using namespace std;/*1. type what kind of the value of the array2. name3. square brackets--> how many values it can store*/int ages[3]; //3 onlyages[0] = 21;ages[1] = 19;ages[2] = 9;/*same as====> int ages[3] = {21,19,9};: faster, easier, and quicke.. User Defined Functions What if we make our own functions..1. First we need function prototype. It tells C++, "Hey, I will make my own function!"2. name of the function--> myfunc3. (declare the type of arguments): void myfunc(int);===> This should be above the main function4. Find the function and pretty much make the functionvoid myfunc(int x){using namespace std;cout Beginning Math Functions We are going to use another library Then we can use all math related library provided by C++#include #include int main(){using namespace std;double num1; //real number in c++cout Prev 1 2 Next