Can you boot into safe mode ?
(Press F8 just before Windows starts to load)
Can you boot into safe mode ?
(Press F8 just before Windows starts to load)
If you can live with an alternative Office Suite, you could use OpenOffice instead, it's very good (and free:) ) !
I'm always using the following programs to speed up my pc:
> SmartDefrag
> CCleaner
> TuneXP
> RegSeeker
And the best of it is: they're all free !!!;)
Try Googling on: "windows 1.0" torrent
...
Sure you will find it, I found at least one torrent ...
Or the free:
> Spybot search and Destroy (from safer networks) !!
> Ad-aware Free (from lavasoft) !
I took the following from the website: QuotePad saves the text selected on the screen without forgetting its source.
It could be very useful !!!
We appreciate you share your knowledge, I believe some people really need an app like that one (you know for school, work etc. ...)
Can your computer read other CD's?
If not so, your CD-drive is screwed up and you should replace it ...
I would go for an external Network Hard disk or a NAS (which is directly connected to the router via Ethernet) ...
As backup software you have a lot of choice ...
Two free and very good backup programs are SyncBack and Cobian Backup (just use Google to find them) ...
Agreed with 'Norton is bulk', but the 2009 version is still a great improvement over the previous versions, but I would recommend using another AV, AVG is a good one, but AVIRA AntiVir is currently getting high marks from AV-Comparatives and it's also free, it's only a matter of choice ...
(If you want to pay I would go for NOD32 !!)
It's class Array2D constructor with ctor-initializer. I hope you can see that it's initial member values definition.
Did you mean constructor with 'ctor' ?
Here are some links which are explaining how to use 'friends':
http://www.codersource.net/cpp_tutorial_friend.html
http://www.cprogramming.com/tutorial/friends.html
Just remember: 'Google is your friend !';)
> You could maybe try creating pointers in the public section of your class and point them to the private data you want to share ...
But you should definitely learn how to use a 'friend', it's a much better way to do this ...
> You could also create an extra class which holds all the data which has to be shared among the other classes ...
This code (which I took from the link in my previous post) raises some questions:
class Array2D
{
public:
Array2D( size_t rows, size_t cols )
: iData( new int[rows*cols] )
, iRows( rows )
, iCols( cols )
{
}
// Add copy and assignment etc.
~Array2D()
{
delete [] iData;
}
int * operator[]( size_t row )
{
return iData+iCols*row;
}
private:
int * iData;
size_t iRows;
size_t iCols;
};
I can't seem to figure out what the following means:
Array2D( size_t rows, size_t cols )
: iData( new int[rows*cols] )
, iRows( rows )
, iCols( cols )
{
}
Hi, I found some (useful:?:) information about 2D-Arrays ...
Actually this is what I need, but could you please take a look at it to ensure the programming style is correct ?
(According to that article my code was right
(except for : Explicit row parameter in destroy2DMatrix: an erron-prone and inconvenient method.
, which I absolutely agree with !), or am I wrong ?)
And what if I implement my own matrix class?
Is it also good if I do the following:
1) Class 'array' (a simple vector):
-> Array is a class which holds a simple 1-dimensional array and the number of elements in the array (in the private section)
-> Overload the '[]' and '=' operators ...
2) Create a class 'matrix' in which I hold the class 'array' ...
-> In this class we create a table of objects from the class 'array'
P.S.: Sorry if my English is bad ...
Bad practice wanted? That's bad practice:
1. C-style 2D array allocation/deallocation functions instead of complete 2D array class with full set of operations.
2. Explicit row parameter in destroy2DMatrix: an erron-prone and inconvenient method.
3. Template function definitions after calls: most of C++ compilers can't process this code.
4. 2D matrix... A matrix is a 2D (2D only) array with specific operators - by matrix definition...
;)
Can you suggest me a better method to do this ?
Can someone please take a look at my code to ensure there aren't any memory leaks or (array) overrides or anything else which could be a bad practice in my code ...
Here's my code:
#include <iostream>
using namespace std;
template <typename T>
void create2DMatrix(int rows, int cols, T **&matrix);
template <typename T>
void destroy2DMatrix(int rows, T **&matrix);
int main()
{
double ** test; /* Needed for our Dynamic 2D Matrix */
create2DMatrix(2, 1, test); /* Create a 2D Matrix */
test[0][0] = 23.59; /* Put some data in the Matrix */
cout << test[0][0] << endl; /* Print the data on the screen */
destroy2DMatrix(2, test); /* Clean up (destroy our 2D Matrix) */
return 0; /* Exit the program ... */
}
template <typename T>
void create2DMatrix(int rows, int cols, T **&matrix)
{
/* Create a 2D Dynamic Array / Matrix */
matrix = new T * [rows];
for(int i = 0; i < rows; i++)
{
matrix[i] = new T[cols];
}
}
template <typename T>
void destroy2DMatrix(int rows, T **&matrix)
{
/* Destroy a 2D Dynamic Array / Matrix */
for(int i = 0; i < rows; i++)
{
delete[] matrix[i];
}
delete[] matrix;
}
Thanks in advance !
Assert is a C++ macro and when the compiler comes across assert, it replaces the assert call with the instructions to evaluate an expression + the instructions to exit the program if the expression returned false ...
e.g.: assert(1>2);
will exit the program because 1 isn't greater than 2 ...
That is not quite correct, see comments
int main(void) { /* Declare the '2D Array' */ char ** ptr = new char * [5]; ptr[0] = new char[20]; ptr[1] = new char[20]; ptr[2] = new char[20]; ptr[3] = new char[20]; ptr[4] = new char[20]; /* Put some data in the array */ // below you lose all the above allocated 20 byte chunks because you // re-assign the pointers to strings, meaning that you cannot anymore // delete the allocated memory, which you should do ptr[0] = "Hello "; ptr[1] = "wond"; ptr[2] = "er"; ptr[3] = "ful"; ptr[4] = " world !!!"; // instead you should e.g.: strcpy(ptr[0], "Hello ") and so on .. /* Print the array on the screen */ for(int i = 0; i < 5; i++) cout << ptr[i]; cout << endl; // you are not deleting the 20 byte chunks here /* Cleanup */ delete[] ptr; /* Wait for the user to press ENTER */ cin.get(); /* Tell the Operating System that everything went well */ return 0; }
Thank you very much for letting me know ...
Do you mean the following?
-> Assign using strcopy();
-> Use a loop afterwards to cleanup ALL the memory ...
C++ doesn't provide built-in support for multithreading, the reason for that is you have to use the operating system's features to write a multithreaded application (as it's the most efficient way) ...
But as Ancient Dragon did already say: The Operating System has to distribute the threads among all the available CPU-cores ...
Maybe this article is useful for you ...
If copy protection also falls under 'plagiarism detection' then you could do the following:
-> Check the MAC-address of the computer and compare it with a list of MAC-addresses in an online database ...
(This is already a very good protection ...)
If plagiarism detection only:
-> You could maybe make use of checksums to verify the program before launching it actually ...
Hope this helps !
P.S.: Sorry if my English is bad ...
I'm always using the following code if I want to use a 2D Dynamic char array:
#include <iostream>
using namespace std;
int main(void)
{
/* Declare the '2D Array' */
char ** ptr = new char * [5];
ptr[0] = new char[20];
ptr[1] = new char[20];
ptr[2] = new char[20];
ptr[3] = new char[20];
ptr[4] = new char[20];
/* Put some data in the array */
ptr[0] = "Hello ";
ptr[1] = "wond";
ptr[2] = "er";
ptr[3] = "ful";
ptr[4] = " world !!!";
/* Print the array on the screen */
for(int i = 0; i < 5; i++)
cout << ptr[i];
cout << endl;
/* Cleanup */
delete[] ptr;
/* Wait for the user to press ENTER */
cin.get();
/* Tell the Operating System that everything went well */
return 0;
}
Hope this helps !
So remember that any memory you allocate with "new" must be freed with "delete" and you need to care of that. It won't happen automatically.
Unless you're using the <auto_ptr> template, in that case the reserved memory will automatically be freed when the pointer goes out of scope ...
This code should work:
#include<iostream.h>
struct batting{
char name[20];
int score;
int out;
};
struct bowling{
char name[20];
int maiden;
int runs;
int wickets;
};
int main()
{
int i,j;
cout<<"How many number of batting&bowling team:";
cin>>i;
batting *bat=new batting[i];
batting *bat1;
bowling *bow=new bowling[i];
bowling *bow1;
cin.ignore(1000, '\n');
for(j=0;j<i;j++)
{
bat1=&bat[j];
cout<<"\nEnter name:";
cin.getline((*bat1).name,20);
cout<<"\nEnter score:";
cin>>(*bat1).score;
cout<<"\nIndication out(out=1&in=0)";
cin>>(*bat).out;
}
cin.ignore(1000,'\n');
for(j=0;j<i;j++)
{
bow1=&bow[j];
cout<<"\nEnter name:";
cin.getline((*bow1).name,20);
cout<<"\nEnter maiden:";
cin>>(*bow1).maiden;
cout<<"\nEnter no: of runs";
cin>>(*bow1).runs;
cout<<"\nEnter wickets no:";
cin>>(*bow1).wickets;
}
int k=0;
cout<<"\n*******Which Information You would like to know?*******";
cout<<"\nEnter 1 for Batting team && 2 for bowling team";
cin>>j;
if(j==1)
for(k=0;k<i;k++)
{
bat1=&bat[k];
cout<<"\nName:"<<(*bat1).name;
cout<<"\nScore:"<<(*bat1).score;
cout<<"\nOut:"<<(*bat1).out;
}
return 0;
}
What did I change?
> First I removed all cin.ignore() statements out of your code ...
> Secondly I added cin.ignore(1000, '\n');
on line 27 and on line 38 ...
Hope this helps !
I did mean 'using the XOR-algorithm' ...
Sorry for this mistake ...
Wow, Sorry, I didn't read the thread carefully ...
I just see that nucleon did already explain why ...
time(0);
or time(NULL);
returns the system time in seconds ...
The C++ Declaration of the 'time()'-function looks as follows: time_t time ( time_t * timer );
So if you pass a NULL-pointer as argument, it will just return the time ...
But between the brackets you can also type the name of a 'time_t' object and call the function with a 'time_t'-object as parameter ...
When doing this the function saves the system time (in seconds) to the 'time_t'-object ...
Hope this helps !
Source: http://www.cplusplus.com/reference/clibrary/ctime/time.html
You could also write a program which encrypts files with the XOR-algorithm ...
Yeah, it's truly right what Ancient Dragon said, but keep on searching ...
Sure you can solve it !
You can maybe write a program to estimate the square root of a given number, or you could write a function 'stod' which converts a string to a double ...
Or a function which checks whether a string can be turned into a number or not ...
Or ... you could write a program which evaluates mathematical expressions ...
Or you can create you own class to provides C++ equivalents for the Visual Basic functions redim
and redim preserve
... etc. etc. ...
Hope this helps !
I think you're having trouble with this code because you're using cin.ignore()
somewhere in your code, I can't figure out anything else which is wrong ...
Just build it like you would build a class library ...
Note: Creating a C++ library depends from compiler to compiler ...
Sorry, /* ENTER WAS PRESSED */
had to be after the else-clause ...
.TXX: DataPerfect Text Storage
(A file format to store ASCII-only characters)
Are your sure it was '.TXX' and not '.CXX'?
'.CXX' is a valid C++ extension ...
I've changed the code from the link Ancient Dragon posted, it's still not complete, but it's more useful ...
#include<iostream>
#include<string>
#include<conio.h>
using namespace std;
int main()
{
string userinput;
char cchar;
int cint;
cout << "Enter password: ";
for(int i=0; ; i++ ){
cchar = getch();
cint = cchar;
if(!(cint == 13)) /* ENTER WAS PRESSED */
{
userinput = userinput + cchar;
putch('*');
} else {
break;
}
}
if(userinput == "password")
cout << "\nPassword accepted.\n";
else
cout << "\nAccess denied.\n";
return 0;
}
I wrote an example program which demonstrates some techniques you can use:
#include <iostream>
using namespace std;
void showArray(const int array[], int size);
void walkArray(const int array[], int el);
int main()
{
const short SIZE = 10;
int array[SIZE] = {25, 30, 35, -40, -45, 65, -95, 85, -50, -15};
int elnum = 0;
cout << "Original array: ";
showArray(array, SIZE);
cout << endl;
cout << "Type element number: ";
cin >> elnum;
if(elnum < SIZE)
{
cout << endl << "Element " << elnum << " is: ";
walkArray(array, elnum);
cout << endl;
} else {
cout << "ERROR: There are only " << SIZE << " elements in the array !" << endl;
}
return 0;
}
void showArray(const int array[], int size)
{
for(int i = 0; i < size; i++)
{
cout << *(array+i) << " ";
}
}
void walkArray(const int array[], int el)
{
cout << *(array+(el-1)) << endl;
}
(I'm aware of the fact it doesn't do what you asked, but it's you who has to write the code, not me)
BTW: Your code looks very much like C ...
> Try to avoid using 'DEFINE' for constants as it's deprecated, use 'const' instead ...
I think you should make use of cin.ignore(1000);
or something like that ...
For more information read the following thread about it:
http://www.daniweb.com/forums/thread90228.html
The error is definitely in the function 'void AddRecord()' ...
I posted function where the error resides in:
void AddRecord(){
int x,y,cmps;char ny,n;
cout<<endl;
do{
if(record[0][0]!=NULL){
for(y=0;y<9;y++){
cout<<inf[y];
cin.ignore(2);
cin.getline(record[count][y],40);
for(x=count-1;x>=0;x--){
if(strcmp(record[x][0],record[count][0])==0){
cout<<"Record already Exist\n";
break;
}else if(record[count][0]==0){
count=count-1;
break;
}else{
cin.getline(record[x][y],50);
}
}
count=count+1;
}
}else{
for(n=0;n<9;n++){
cout<<inf[n];
cin.ignore(2);
cin.getline(record[0][n],50);
}
count=1;
}
cout<<"Do you want to add Data[y\\n]:";cin>>ny;
}while(ny=='y'||ny=='Y');
}
It's ridiculous
That's just so weird
You're absolutely right !!
185 characters. :P
Actually there are 186 characters ...
I used the following program to count it (sure it can be written in a shorter way ;))
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
char chr;
int c = 0;
ifstream file;
file.open("test4.cpp"); /* Replace test.cpp with the name of the file where you want to count the characters of */
while(!file.eof())
{
file >> chr;
c++;
}
cout << c << endl;
return 0;
}
BTW, why do you use 'list.h' ? It doesn't compile with that ...
You can maybe create your own header file called 'h'
and put the instruction #include <iostream.h>
in it (if it's allowed to use a seperate header file) ...
After that you can replace #include <list.h>
with #include "h"
I've made some changes to your code
(there were some logical bugs in your program)
I'm not pointing out them in this post, I just want to refer you to your own code and compare it with the (working(?)) code below:
#include <iostream>
#include <cstdlib>
using namespace std;
/******************** CLASS DECLARATION(S) ********************/
class HotDogStand
{
public:
HotDogStand();
HotDogStand(int newID, int newNnumSold);
int GetID(){return NID;};
int GetNumSold(){return NSold;};
void SetID(int newID){NID = newID;};
void JustSold();
void JustSold(int count);
int GetTotalSold(){return TotalSold;}
private:
int NID, NSold, TotalSold, count;
};
HotDogStand::HotDogStand()
{
NID = 0;
NSold = 0;
TotalSold = 0;
}
HotDogStand::HotDogStand(int newID, int newNnumSold)
{
NSold = 0;
TotalSold = 0;
NID = newID;
NSold = newNnumSold;
TotalSold += newNnumSold;
}
void HotDogStand::JustSold()
{
NSold = 1;
TotalSold++;
}
void HotDogStand::JustSold(int count)
{
TotalSold += count;
NSold = count;
}
/**************************************************************/
/************************ MAIN PROGRAM ************************/
int main()
{
HotDogStand s1(1,0);
HotDogStand s2(2,0);
HotDogStand s3(3,0);
HotDogStand s4;
s1.JustSold();
s2.JustSold();
s1.JustSold();
s4.JustSold();
cout << "Stand " << s1.GetID() << " sold " << s1.GetNumSold() << endl;
cout << "Stand " << s2.GetID() << " sold " << s2.GetNumSold() << endl;
cout << "Stand " << s3.GetID() << " sold " << s3.GetNumSold() << endl;
cout << "Stand " << s4.GetID() << " sold " << s4.GetNumSold() << endl;
cout << "Total sold = " << s1.GetTotalSold() << endl;
cout << endl;
s3.JustSold();
s1.JustSold();
s2.JustSold(5);
s1.SetID (99);
s4.SetID(4);
cout << "Stand " << s1.GetID() << " sold " << s1.GetNumSold() << …
what does your xorg.conf look like? (can be found I think in /etc/X11/xorg.conf, not 100% sure about where it is in BSD)
The problem was: I had no 'xorg.conf' file ...
My problem is solved now, thank you to both of you !
Hello, first of all I'm not a Unix expert at all (otherwise I wasn't asking this question), but I'm having some trouble starting my X-Server ...
When I type the following: startx
or X
I get the following error message(s):
...
No core pointer
Fatal server error: Failed to initialize core devices
...
Please also check the log file at "/var/log/Xorg.0.log" for additional information.
The contents of the "/var/log/Xorg.0.log" log file:
(II) I810(0): xf86UnbindGARTMemory: unbind key 7
(II) I810(0): xf86UnbindGARTMemory: unbind key 8
(II) I810(0): xf86UnbindGARTMemory: unbind key 9
I'm using FreeBSD 6.0 (Yes, I know it starts getting dated)
(My computer: Dell OptiPlex GX110, I'm using an USB mouse)
Thanks in advance !
P.S.: Sorry if my English is bad, my native language is Dutch...
> What exactly are you trying to do?
> Are you creating a class library?
=> In this case you'll have to compile it to object code first and after that you can create a library from it ...
> Are you writing a stand-alone program?
=> In this case you'll have to add a main()
function to your program, you know:
int main()
{
/* Your code here */
return 0;
}
> What compiler/IDE are you using ?
P.S.: I can confirm that with me your code compiles perfectly, without any warnings or errors, I'm using the Borland Compiler ...
The following code is a simple example of a for-loop:
for(int i = 0; i < 3; i++)
{
/* Your code here */
}
This loop repeats the instructions between the '{' '}'
3 times ...
But as Ancient Dragon said, first try searching Google (in future) before you ask a question which you could simply solve yourself ...
Come on man,I considered c++ programmers smarter.
its just an example of a pointer.
They're also smart, but if you aren't giving any detailed information about your problem we can only guess about it ...
If you do a quick google search you can find it within exactly 2 seconds, so try doing this before you post ...
(You might consider looking at this link: http://java.functionx.com/cpp/examples/returnpointer.htm)
Yeah, do something like siddhant: put cin.ignore();
after cin.getline(name,20);
it works !!
(credit goes to siddhant)
Just, declare a pointer as you always do ...
<type> * <name>;
e.g.: int * ptr;
The posted code is also working for me (both, without removing the .'h' and with removing the '.h' from the include directives) ...
I'm using the Borland Compiler ...
P.S: Ancient Dragon asked you: Which compiler are you using ?