611 Posted Topics
Re: What error?? take your time and explain your problem very well. We need to understand what you want to achieve before we can assist you. | |
Re: Can you be a little clearer about what you want to achieve. Are you looking into reading an entire file and check how many times a character appears in the file and pupulate that into an array??? Can you please explain yourself better.? | |
Re: If you can show us some code about your quest, maybe we may help you achieve your goal. | |
Re: on `line 6` you have `char *prog_arv[4];` this is like char `**prog_arv`. you need to remove * to have `char prog_arv[4];` for the way you intend to use the char array. | |
Re: Deleting data in vector comes with a lot of work. For your operation, you need to consider list. Now based on your code , from line `49` to end. i dont personally like how you are dealing with the vector. vector comes with iterator to use to loop through your … | |
Re: You need to post your error and the line that the error points to. You have different `headers` that we dont have access to test your code. | |
Re: Are you that lazy even to google around? What sort of laziness is that? What you need is everywhere on google. If you cant help yourself... then do not expect any help from anyone here. | |
Re: Its everywhere... do a little searching ok? we are not here to work for you. just do yourself a little googling. | |
Re: Your code please??? | |
This is a basic CPP sleep fuction. As you can see CPP libs do not come with a time sleep/wait fuction to use in your code/loop. So due to boring jurney to Saint Petersburg, i decided to write something/code to give anyone who has been wondering why CPP does not … | |
Re: i will give you a full code for $400. Deal? | |
Re: And i guess he need to initialize the first clock outside the while loop so that there will be a difference in the starting and outside the finished while loop get a new clock to minus the starting time from the ending time and the results is the time taken. … | |
Re: To add further information to JasonHippy's answer just do `cout<<3%5;` | |
| |
Re: have a look at the setw() from the lib iomanip. for(int c=0;c<10;c++){ cout << std::setw(c+5)<<c<<endl; } cout <<setw(25)<<"Merry xmas "; // simple alc (10*2)+5 //out put 0 1 2 3 4 5 6 7 8 9 Merry xmas | |
Re: This is done simply with the for_each loop plus lammbda. #include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { vector <int> vec ={1,2,3,4,5}; for_each(vec.begin(), vec.end(),[](int &c){ cout << c+2 <<endl;}); return 1; } ## out put 3 4 5 6 7 Happy? )) | |
Re: I will bet on runtime error. Something like array overflowed or Segfault. Like the Dragon said. post your error. | |
Re: line 27 `void openfile(ifstream &inFile)` but the operation of that funtion is a bit lame because the is no logic only passing the stream object only to be asked for such operation. I will advice you put a bit planing in your code. 1. `char *getFile name(char *filename)` for file … | |
Re: $500 in 1 day plus support even in GUI. | |
Re: You are doing everything wrong according to me. Sorting is very simple once you understand how its done. Take a pencil and a paper and make a sketch. you need a `*temp` to hold on to the checks in the if statement. example node::sort(){ node *temp=0; node *start=head; while(start !=0){ … | |
Re: I have the code ready... Let me know when you need it so i can post it here for you ok? Read the FAQ's first anyway ok? | |
Re: Also goto is legal in c++, its not a good practice to use it at all. Debuging and teamworking will be a hell for both parties. Its one big comand you should stay away from. Why not simple recursive function or a while loop? | |
Re: declare the operator inside the class. Then use bool Myclass::operator<() | |
Re: Read the entire file to a string and use string lenght function. This entirely depends on the size of the file. Just another way. How ever you can know the file size without reading the file to do the count++; I would rather not read the file only for its … | |
Re: Take of the code from line 12-16 and use this dont forgrt to include the algorithm lib `for_each(ptrList.begin(),ptrList.end(),[](int *c){ cout << *c-1;});` | |
Re: Can you even post your code and error? Show some relationship with your claim ok?. | |
Re: for insrtion sort. you need to go like this. psuedo. void insertSorted( person *p){ //takes the node pointer person person * newNode =p; // person * curr = 0; // formality person *worker = head; // if(head ==0){ // check if there's no node head = newNode; } else{ while(worker … | |
Re: I will use associative array or any think like a hash. read in the string and insert it into the object. pseudo user dataType<string,int> foo; string data; getline(cin,data); loop through; for(int c =0;c< data.lenght();c++){ //now yu check to see if the letter has been entered before. //in this case string … | |
Re: So whats is your question?? I smell homework. That code was from from your instructor for you to update. what is your question....? | |
Re: Are you for real..? | |
Re: I think its only polite for me to add this to dragon's. You should have functions to handle your code as it is very unconfortable to go through your code. its really not confortable at all. | |
Re: Mate you miss the road. This is not java but CPP pot. Get out.... | |
Re: on number 74, we dont read data like that. it must be `cin>> filename` Also this is purely a homework that you have not touched. Its partially given by your instructor for you to do the res so be kind and show us what you have included so far ok? | |
Re: No he will not. We help but not solve the problem. Ask your friend to provide what he has done so far. | |
Re: code please. | |
Re: you can use assert to verify the datatype entered if its a type int or char then make your decision. Very handy . | |
Re: Whats is your error and also what do you intend to achieve with your code. Give more information next time you ask for a help. We cant read your mind. | |
Re: Also on number 1. `void ReadStudentData(ifstream& infile, StudentType*& student, int& numOfStudents)` whats the point of `int &numOfstudents` as a reference if you just write to it on line 12 `infile >> numOfStudents;` like this. If you ntend to write to it like this, then there is not need to even … | |
Re: sure well said; on line 1 ; is the bad fox. | |
Re: Errors fixed. Now work on your magic function #include <iostream> #include <fstream> #include <cstring> using namespace std; void PrintMatrix( int x[][20], int size) { for(int i = 0; i < size; ++i) { for(int j = 0; j < size; ++j) { cout << x[i][j] << "\t"; } cout << … | |
Re: A little update struct personal { std::string name; std::string phone; std::string DOB; }; int main(){ personal per[10]; static short count=0; while(count <10){ //ask for name entry //then cin cin>>per[count].name; //ask phone cin>>per[count].phone; cin>>per[count].DOB; count++; } return 0; } |
The End.