611 Posted Topics

Member Avatar for karaman1

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.

Member Avatar for Meron Aragaw
0
123
Member Avatar for mixelplik

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.?

Member Avatar for Ancient Dragon
0
366
Member Avatar for andreas.petrou.967

If you can show us some code about your quest, maybe we may help you achieve your goal.

Member Avatar for richieking
0
169
Member Avatar for sireiz
Member Avatar for jax prajapati
Member Avatar for Jokatech

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.

Member Avatar for Ancient Dragon
0
201
Member Avatar for johnson_2

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 …

Member Avatar for johnson_2
0
5K
Member Avatar for dodd7

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.

Member Avatar for richieking
0
208
Member Avatar for aroshkhan
Member Avatar for moudy.mak

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.

Member Avatar for richieking
0
152
Member Avatar for Adeel Rahat
Member Avatar for moudy.mak

Its everywhere... do a little searching ok? we are not here to work for you. just do yourself a little googling.

Member Avatar for richieking
0
141
Member Avatar for Jokatech
Member Avatar for richieking

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 …

Member Avatar for deceptikon
0
2K
Member Avatar for hihamda
Member Avatar for intelharsh
Member Avatar for mrmodest34

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. …

Member Avatar for meta.quota
0
511
Member Avatar for Ahtsham

To add further information to JasonHippy's answer just do `cout<<3%5;`

Member Avatar for richieking
0
278
Member Avatar for Aisha_1
Member Avatar for ron_1

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

Member Avatar for richieking
0
133
Member Avatar for priyanka.choudhary.90038

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? ))

Member Avatar for richieking
0
256
Member Avatar for Eric_7

I will bet on runtime error. Something like array overflowed or Segfault. Like the Dragon said. post your error.

Member Avatar for richieking
0
244
Member Avatar for imalysha425

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 …

Member Avatar for richieking
0
260
Member Avatar for Sara_6
Member Avatar for H_beginner

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){ …

Member Avatar for richieking
0
314
Member Avatar for Chinney
Member Avatar for vaishali.k

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?

Member Avatar for yazan.quraan.39
0
157
Member Avatar for Rohan_1

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?

Member Avatar for Ancient Dragon
0
204
Member Avatar for jonathan710
Member Avatar for richieking
0
423
Member Avatar for HenryR7

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 …

Member Avatar for richieking
0
189
Member Avatar for jonathan710

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;});`

Member Avatar for nullptr
0
262
Member Avatar for jonathan710
Member Avatar for Ancient Dragon
0
154
Member Avatar for ariel930

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 …

Member Avatar for richieking
0
5K
Member Avatar for mc3330418

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 …

Member Avatar for mc3330418
0
198
Member Avatar for batoul.dje
Member Avatar for spritzer
Member Avatar for jonathan710

So whats is your question?? I smell homework. That code was from from your instructor for you to update. what is your question....?

Member Avatar for richieking
0
335
Member Avatar for gonzalez50
Member Avatar for moon.fall.58

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.

Member Avatar for Ancient Dragon
0
194
Member Avatar for Derek_4
Member Avatar for Derek_4
0
393
Member Avatar for HenryR7

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?

Member Avatar for HenryR7
0
150
Member Avatar for leenana
Member Avatar for jhan.rhey.5

No he will not. We help but not solve the problem. Ask your friend to provide what he has done so far.

Member Avatar for jhan.rhey.5_1
0
638
Member Avatar for lincy828
Member Avatar for klfrancisco

you can use assert to verify the datatype entered if its a type int or char then make your decision. Very handy .

Member Avatar for deceptikon
0
321
Member Avatar for hassan12

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.

Member Avatar for richieking
0
117
Member Avatar for beastie805

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 …

Member Avatar for richieking
0
185
Member Avatar for whatthebobo
Member Avatar for Cj

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 << …

Member Avatar for richieking
0
1K
Member Avatar for Samier999

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; }

Member Avatar for richieking
0
351

The End.