elsiekins 0 Junior Poster

create a JAVA_HOME evn variable and add its bin directory to the PATH variable; use the JDK instead of the JRE

Thanks but already tried :(

elsiekins 0 Junior Poster

Hello,

Unforunatly had to replace my hard drive on my laptop so having to start from scratch, i already had eclipse installed, so when i went to reinstall, downloaded JRE and JDK and 32bit eclipse (my machine is 32bit vista) but i get the error message
"A java Runtime Environment (JRE) or Java Development kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations: C:\eclipse\jre\javaw.exe javaw.exe in your current PATH"

I have tried changing JRE and JDK versions and adding the -vm as in eclipse documentation, Also trawled through the internet no hope. I have installed blue j and net beans with no problem.
Any solutions or ideas much appreciated
Thanks

elsiekins 0 Junior Poster

elsiekins, the source you mention is for the examples in the chapters.

Yes and if you look at what the orginal OP has written that is what they are asking

elsiekins 0 Junior Poster

look at http://www.acceleratedcpp.com/ there is source code from here

elsiekins 0 Junior Poster

@mike
@ravenous

Why do you think he's been banned from those sites?
Don't waste your time.

On the other hand...

*getting the popcorn*

it might be where the OP is working from they filter those sites - come on who has ever been banned fro wikipedia!

elsiekins 0 Junior Poster

Are you trying to create a double linked list that has a head node and a tail node with zero or more nodes linked in between? Because if that's your intent, you'll have get your 'linked_list_create' to create and link both of them(head and tail node) initially.

yes - if you look at my code you will see that i do have them linked - the linked_list_create is fine i have had it checked.

elsiekins 0 Junior Poster

Line 80

linked_list_push_back(11, 99);

Your passing the number eleven not your linked list pointer ll.

thanks but on my complier the font makes them look the same.
its mainly the push back function i am worried about

elsiekins 0 Junior Poster

This thread is old please start new thread

Hi everyone
Recently I've been having the same problem with my p28 (been running sweet for years with various upgrades) and after reading through the thread I would have to agree with gigigigi in that the graphics is to blame. I've been running windows 7 on it for nearly a year and it seems to have better diagnostics than xp, since the 'action centre' told me that there's a problem with my video card and asscociated drivers. To be honest the problem was detected when win 7 was first installed cause I the action centre message was dated round about that time, I must have just ignored it - laptop was running fine afterall. Having all the symptoms thats been described: crashing to blue screen, random freezing with no error messages, having black screen after power on- hdd and cd drive responding properly, and knocking the underside near cpu reviving it for a few hours. I've also tried a different hdd, ram chips, and even a different cpu but all had no effect.
All of you will probably have sorted it out by now, one way or another, but thought i'd confirm the cause of the problems. :)

elsiekins 0 Junior Poster

Hi - i have been trying to create a linked list in C using structs and there are a couple of things i am stuck with how to declare the node front and back and do i keep repeating myself?
Also in the function push back how can i use the linked list i created ?

#include <stdlib.h>

typedef struct node
{
    int data;
    struct node* next;
    struct node* prev;
};

typedef struct llist
{
    struct node* front;
    struct node* back;
}llist;


llist* linked_list_create()
{
    llist* aLL = malloc(sizeof(llist));
    aLL->front = 0;
    aLL->back = 0;
    return aLL;
}

int linked_list_push_back(llist* aLL, int value)
{
   
 struct node tmp; 

tmp::value;
    int front= 0;
    struct node *newNode;
    newNode = (struct node *)malloc(sizeof(struct node));
    
    
    if(newNode != 0)
    {
        newNode->data = value; 
       
       newNode *next= front;
        newNode->prev = newNode ->next;
        return 1;
         
    }
    return 0;
}

int linked_list_pop_back(llist* aLL, int value)
{
   	
		    struct node * popped;
            popped = (struct node *)malloc(sizeof(struct node));
	    struct node* curr = front;
            struct node * curr;
            curr = (struct node *)malloc(sizeof(struct node);*/

if (popped != NULL)
		{
                        struct node* curr;
			popped = curr;
		        curr->next;	
			
			back->next = NULL;
 
			
			if (curr == front)
			{
				front = NULL; l
			}
 
			
           
            
		}
  
}
void main()
{
    llist* ll = linked_list_create();
    linked_list_push_back(11, 99);
    linked_list_pop_back(ll,9);

}

Thanks

elsiekins 0 Junior Poster

Done any of this even started?

elsiekins 0 Junior Poster

There is most likely a warning level you can set to have the compiler only display more critical warnings.

http://www.cplusplus.com/reference/string/getline/

Any idea why it is actually bringing up this warning ? and why ?

Thanks

elsiekins 0 Junior Poster

Hello

Using :

cout << "enter 5 letter";
getline(cin, letter);

executes fine but when running PC- Lint:
getline(cin, expectedLabel): error 534: (Warning -- Ignoring return value of function 'std::getline(std::basic_istream<char,std::char_traits<char>> &, std::basic_string<char,std::char_traits<char>,std::allocator<char>> &)'
error 830: (Info -- Location cited in prior message)

I was wondering if anyone could tell me the problem with getline and is there an alternitve i do wish to enter 5 letters

elsiekins 0 Junior Poster

Thanks was not sure what was needed

elsiekins 0 Junior Poster

Hello,

I have a program that uses getchar() and slightly confused and tried googling and it made it worse

cout << ">What is the expected letter <<"\n>";
        expectedLetter = getchar();
        putchar(expectedLetterl);
        string exletter = expectedleter + post;

cout <<">Do you wish to enter another letter (Y/y)/(N/n)\n>";
           repeatIn = getchar();
           putchar(repeatIn);
           if (repeatIn == 'y' || 'Y')
           {
               repeat = true;
           }

i have tried using

while(getchar()!='\n');

to clear the buffer , is there any other way / method? is there a simpler way to do this ?

Thanks

elsiekins 0 Junior Poster

Can you ? even if its a little bit ? no one on here is going to write code for you!

elsiekins 0 Junior Poster

Thank you all for your reply's
@jonsca - Unfortunately i did not write the function and cannot change it
@L7Sqr - I cannot use String.
@waltp - jonsca method works as i can just return false if more than one input is entered.

elsiekins 0 Junior Poster

Hi,
i have:

string letter;

cout << ">Please enter a letter: \n>";
        getline(cin, letter);

What i am trying to work out is how to restrict the user for only entering one letter - has to use a string due to being used in a function later which only takes a string .... i know i hate to say this on here but help ( have tried googling) :D

Thanks

elsiekins 0 Junior Poster

So why dont you ask for an extension and ask your teacher for help ??

elsiekins 0 Junior Poster

I cant wait i just wish the tickets were not so expensive ! anyone and idea when next years tickets go on sale ? it would really be a who to support england or wales...

elsiekins 0 Junior Poster

Hi,

Uninstall Your current driver for Bluetooth.

how would this affect it ?

elsiekins 0 Junior Poster

check if has nvidia problem manufacturer or seller will repair it free else ditch

elsiekins 0 Junior Poster

From the looks of it when you select the number the program prints out a tree by looping for more information on loops see http://www.cplusplus.com/doc/tutorial/control/ its halfway down the page.

for(j = 1; j <= lines*2; j=j+2)

as for this bit of code it is saying that from j is equal to one and j is less than the number of lines *2 add two to j- this is the control statement

elsiekins 0 Junior Poster

check the labels on your laptop, i only suggested it because it has exactly the same symptoms as that defect :)

elsiekins 0 Junior Poster

Just had the same happen to my VAIO VGN-A317S.

Can anyone tell me where the CMOS battery is, so I can try removing it?

Thanks,

well if anyone paid attention the problem above sounds like the nvidia defect problemgoogle it - so call / go into the place you got it from

elsiekins 0 Junior Poster

ok that was weird half my post didnt turn up . call / go into where you bought it for and ask for a repair due to your suspicions it is the nvidia defect else if you really have paitence call hp.
http://www.pcpro.co.uk/news/230097/updated-hp-confirms-nvidia-flaw-hits-desktopslittle bit more info

elsiekins 0 Junior Poster

Firstly nothing will sounds like the good old nvida defect bit of info there. I would say phone HP but it is such a pain in the ass! take it back to where you bought it and they should hopefully sort it if not there is support here. I went through the same thing about a year ago :)

elsiekins 0 Junior Poster

This is what i ended up doing:
create an array of size 1 then when calling it in a function which takes in a size set this to zero.

elsiekins 0 Junior Poster

not sure if this is completly relevent but insted of

if (*(tableRow + (int)Name) == NULL || (tableRow[(int)Name]) == "")

alterntive

if(*(tableRow +name) == ""

it seems to me you are checking twice
"" is an empty string

elsiekins 0 Junior Poster

i'm guessing if he can't use arrays then vectors are off the table.

not necessarily - i got taught vectors before an array

elsiekins 0 Junior Poster

is your program stored in the same directory of as the program - you also need to give it the root of where the file is

elsiekins 0 Junior Poster

I solved mine by looking on internet explorer proxy settings unfortunately chrome takes these from IE

elsiekins 0 Junior Poster

can you use vectors?

elsiekins 0 Junior Poster

dont know if this is any help just glancing here but you can use a swap template - Example:http://www.cplusplus.com/reference/algorithm/swap/

elsiekins 0 Junior Poster

Don't buy the HP Pavilion there are major problem with the motherboard - tbh just go into a computer store and look around see which ones you like, my final decision was made on how pretty it looks , also look at the weight of each laptop

elsiekins 0 Junior Poster

the answers are so general, for example it is unclear for me where should argc and argv initialize if needed. and some other details.
if it is possible send me a code that these were be used in main part of program.

by the way there is not a reason for me not to be honest.

you never really specified what you wanted to know

elsiekins 0 Junior Poster

to be honest i do think the replies explained it very well, what exactly do you want to know if the current replies are not good enough?

elsiekins 0 Junior Poster

No i didn't write the function i was given it to write a test program for it. Will try your way thanks

elsiekins 0 Junior Poster

>>it was similar to a question asked a couple of days ago
I figured as much, but only those involved in that thread (myself NOT included) will know what you're talking about.
>> Sorry

>>be nice i have a stinking cold aching shivering and anything and trying get my head around pointers only just cracked arrays
Not real sure where the "be nice" came from, but okay...
>> your first reply came across a bit harsh :)

Do you know how passing by reference works for an int, for example? Passing a vector by reference works the same way, you just need to say that you're passing a vector of _________ (fill in the blank) values to the function instead of a single value.

Something like this:

#include <iostream>
#include <vector>

using namespace std;

void populateVector(vector<int> &);

int main() {
  vector<int> myVector(10, 0);
  populateVector(myVector);
  for (int i = 0; i < myVector.size(); ++i) {
    cout << "Element " << i << " is " << myVector[i] << endl;
  }
  return 0;
}

void populateVector(vector<int> &localVector) {
  for (int j = 0; j < localVector.size(); ++j) {
    localVector[j] = (j + 1);
  }
}

You could also use vector::push_back() as Clinton mentioned. That would require changes to the declaration and the for loop in populateVector(). The method I have demonstrated, creates all elements of the vector before passing instead of after.


I would not recommend using such third-party extension functionalities until you are first familiar with …

elsiekins 0 Junior Poster

Not entirly sure if it makes a differnace but i am using

#include <boost/assign/std/vector.hpp>

the += usually works for my previous programs may try your second method

I just checked the documentation for the vector class and it appears that <vector> does not offer an overloaded += operator. It seems that only the = assignment and [ ] subscript operators are offered.

It looks as though you are trying to push char type variables into your vector. Probably the common vector class member function you will use is push_back()

for(char c = '1'; c < '5'; c++)
{
     //This is how you put stuff in a vector
     something.push_back(i):
}

Since the vector class does offer a [ ]subscript operator, which we can use to access the individual element of the vector array:

for(unsigned int i=0, size=something.size(); i<size; i++)
{
     //whatever this function does, we will iterate through all elements of the something vector and pass each char into the function
     //Your function requires a char pointer
     somefunction(&something[i], i);
}
elsiekins 0 Junior Poster

>>Simmilar problem again using a vector of length 4
Similar to what? What are you trying to do? If you're trying to pass a vector to a function, you have not defined your arguments/parameters correctly.

To pass a vector to a function, you should define the parameter as a reference to a vector, not an individual object of a specific dataType.

How would i provide a reference ? I have also not provided the exact code i am using due to not being able to.
and it was similar to a question asked a couple of days ago - be nice i have a stinking cold aching shivering and anything and trying get my head around pointers only just cracked arrays :?:

elsiekins 0 Junior Poster

Simmilar problem again using a vector of length 4

vector <char> something;
 something += '1','2','3','4';


 somefunction(something,4);

some function takes in a

char* ptr, unsigned int size

at the moment i am getting
"error C2664: 'something' : cannot convert parameter 1 from 'char' to 'char *"
any help would be appreciated even if i am not doing the obvious i have tried looking online even adding
char* psomething = something;
but that doesnt work well gives me more error messages

elsiekins 0 Junior Poster

I have a similar problem with my Gateway laptop. No power. I've tried the suggestions outlined above, but nothing happens, with or without the battery installed. Any further suggestions? Marcus

does it have a nvida graphics card in it ? it sounds like a simmilar fault that HP and dell's

elsiekins 0 Junior Poster

I know for java (i haven't used it alot for c++) that you can get emulators for blackberry and things like that in Eclipse

elsiekins 0 Junior Poster

Here is the real solution

char  anArray[32]= "123456"; // <<< This is how to initialize the array with some text
      
 
// char*  pAnArrray = anArray; <<< This is an unnecessary pointer
// the function call 
 
someFunction(anArray) // << this is how the array should be passed to a function

thanks - i was told by the person who set it should for this particular program it should point to an array.
Thank you though i will note it down for future reference

elsiekins 0 Junior Poster

solution for other peoples future referances

char  anArray[32]= 
           {'1', '2', '3', '4', '5', '6'};
      
 
 char*  pAnArrray = anArray;
// the function call 
 
someFunction(&anArray[0])
elsiekins 0 Junior Poster

you could use a technique called 'pointer arithmetic' to access ye' array:

#include<cstring>

//dynamic array
char* array = new char[11];

//breaking into the ol' C library to handle the array cstring
strcpy(array, "I Love C++");

//display the array using pointer arithmetic method:
while(array != NULL)
{
     cout << *array;
     array++;
}

No subscript operator needed; you are using pointers and pointer arithmetic to move about in system memory.

thanks but when i try and use strcpy it does not like the amount i have in the array. and
@ancient dragon - just gonna read that now thanks

elsiekins 0 Junior Poster

Hi,
I have a method call say some fucntion that takes in a pointer of an array of char

char  anArray[32]= 
           {'1', '2', '3', '4', '5', '6'};

// the function call 

someFunction(&anArray[0])

I don't think I have quite grasped the concepts of pointers yet, does the code i have written above apply a pointer to a function ?

thanks

elsiekins 0 Junior Poster

What windows version are you using?

Are you able to install any application? Are you able to uninstall applications? If you are able to do both install Revo Uninstaller first then go into safemode and uninstall all the unnecessary applications.

Then install Malwarebytes http://www.malwarebytes.org/ and scan the system after disconnecting from the internet (just a precaution anyway).

If all this fails, please let me know.

also before you run the scan run it in safe mode
and if u r running IE or chrome be warned it will change your proxy settings

elsiekins 0 Junior Poster

it also depends on your computer as well there are many positive and negative issues about - just download loads and try them out see which one feels right for you

elsiekins 0 Junior Poster

It is possible to declare array[0] in c#. But in c# it's a class and it has a method called resize() which gets called automatically when the number of element exceeds the available space in array. Same with java.

i don't know c# the program i have written is in c++
i knew you could do it with java but am coming from a java background to c++