CSCI 1060U Study Guide - Midterm Guide: A.Out, Chartered Mathematician, Machine Code

168 views5 pages

Document Summary

G++ is c++ compiler in gnu compiler collection (gcc) -> compiler compiles code into machine code. C like initialization (int x = 6,y;) Declaration, initialization, usage x = ++x; -> 11 z = z++; -> 10 codes are read from left to right. ++x means add to x first, then process statement. ++z means process statement first before adding (so z=z is processed first before z is added) > file input/output (some other file name) -> you are importing a file. If you assign double expression to variable declared as max, memory overflow, and you only get float. #include srand(time(null)); rand()%a + b (if you want to find 2-10, a-1+b = 10, b = 2) Ifstream is cin is take things from file getline(from, to) ofstream/ifstream name_to_call_file ( name_of_file ) Or add a separate line with name_to_call. open( name_of_file ) Ofstream is cout is unleash and write into file. You can call files from other directory by directory/file_name.