the use of functions in C++ is great for creating much more complicated programs. using them allows the programmer to split tasks throughout the program and making them able to run one at a time instead of all at once. For example;
#include <iostream>
using namespace std;
void class();
void school();
int main()
{
class();
school();
}
void class()
{
cout<<"class has begun now!\n";
}
void school()
{
cout<<"school is now over!\n";
}
this allows for the program to split up the processes so that more than one thing can be accomplished with the single program compared to being restricted to one thing and one thing only.
Taking into account that functions still need to be called this allows the user to be able to call them and end them when needed for functionality of the program or the needs of the software.
Wednesday, 7 May 2014
day 45
using C++ I have discovered that it is possible to create a text file and write to it using a compiled program.
there is a directory of code located in a header file called <fstream> that allows you to be able to do this using lines of code like;
int main () {
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}
when looking at this you can see that the line
'ofstream myfile' will create the file you wish it to
'myfile.open ("example.txt");' is creating the text document for you
'myfile<<"Writing this to a file.\n";' is putting text in the file for you
'myfile.close()' is closing the file for you
using these you can make a text file as well as write to it, using a program you have made.
there is a directory of code located in a header file called <fstream> that allows you to be able to do this using lines of code like;
int main () {
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}
when looking at this you can see that the line
'ofstream myfile' will create the file you wish it to
'myfile.open ("example.txt");' is creating the text document for you
'myfile<<"Writing this to a file.\n";' is putting text in the file for you
'myfile.close()' is closing the file for you
using these you can make a text file as well as write to it, using a program you have made.
day 44
reformat complete on laptop. Current status is partly installed for programs. Compiler installed for computer work as well as a few other key software installs; chrome, malwarebytes antimalware, avast antivirus and a few others. Problem is now gone I can leave my computer alone for any length of time and not worry about it shutting down what I was working on.
day 43
Problem with computer continues. Now interfeering with ability to compile programs or to make 3d models. I have gone to the last resort and am now going to wipe my laptop and resintall ASAP. backing up all programs and other essential items; pictures, videos, documents, downloads, as well as a list of all programs installed on this device.
day 42
ran into computer problems with laptop. Seems to be mouse drivers as my computer keeps selecting and deselecting windows if the mouse is left for more than 2 mins without being moved. Doesnt matter if it is touch, track pad or hardware mouse attached externally. currently have tried uninstalling and reinstalling mouse drivers still not working.
day 41
file recovery on phone to find lost photos. Managed to get 100+ usable pics from the device other than the 23 corrupted ones. Program used was Asus data recovery software. Among other things found were a few videos as well as pics from webpages visited on the device.
day 40
Fan problems in a laptop; noises, vibrating ect... I disassembled the laptop and discovered that the fan had been dead for at least a year now. The computer showed signs of overheating as well as loss of fan movement. After disassembling the laptop I found that the fan was jammed but had been for quite some time and is now unusable and needs to be replaced.
Subscribe to:
Posts (Atom)