User Profile

Collapse

Profile Sidebar

Collapse
stealwings
stealwings
Last Activity: Apr 26 '07, 09:13 AM
Joined: Feb 1 '07
Location: China
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • stealwings
    replied to Access Violation----Why is that?
    in C
    Sorry for the trouble, I already realized that it was a logical problem, it is solved, but I got this new problem, I have the part of the code as follow:
    Code:
    int first=0;
    int last= StandardSize-1;
    int mid=(first+last)/2;
    //cout<<MyWords.size()<<endl;
    	for (int i=0; i<MyWords.size();i++)
    	{
    		while(first<=last)
    		{
    			if(MyWords[i]>Standard[mid].substr())
    				first=mid+1;
    ...
    See more | Go to post

    Leave a comment:


  • stealwings
    started a topic Access Violation----Why is that?
    in C

    Access Violation----Why is that?

    I have implemented a binary search and some other functions to my code, when I compile it, it gives me no error, but when I run it, it gives me an Access violation, why? Can some one explain me plz. Thanks in advance.
    Code:
    // SpanishBreakPredict.cpp : Defines the entry point for the console application.
    //
    
    #include "stdafx.h"
    #include <iostream>
    using namespace std;
    #include <fstream>
    ...
    See more | Go to post

  • stealwings
    started a topic Unicode in c++
    in C

    Unicode in c++

    Hello all,
    I wrote a sorted array with Unicode characters inside but I get 19 error when I compiling it, why is that? All the errors are because it is said that it's too big for a character, but only some of them give me error. Can some one help me?
    the array is like this:
    Code:
    char* SortedArray[]=
    {
    	"a base de",
    	"a continuaci\xF3n",
    	"a diferencia de",
    ...
    See more | Go to post

  • stealwings
    replied to LinearSearch to BinarySearch
    in C
    Ok thanks again DeMan, I will try my best to figure it out these days, and if I have further questions I will continue pop upping the post, if these is not against the forum's rules. Or shall I star a new post further?
    See more | Go to post

    Leave a comment:


  • stealwings
    replied to LinearSearch to BinarySearch
    in C
    I still don't get it, can some one help me out with my question??? Thank you all in advance!
    See more | Go to post

    Leave a comment:


  • stealwings
    replied to LinearSearch to BinarySearch
    in C
    Thank you DeMan, but the problem here is I don't get how can I chop off Doug and does and how to concatenate work back to excellent, sorry if I driving you crazy but that is the exact thing I want to know. I mean, I also have the idea of how should it work but I don't know how do I code that idea....
    See more | Go to post

    Leave a comment:


  • stealwings
    replied to Compare text and replace!
    in C
    Yes, thank you DeMan :)...
    See more | Go to post

    Leave a comment:


  • stealwings
    replied to LinearSearch to BinarySearch
    in C
    Thanks, but I think I haven't been clear in my question. I have I sort array of phrases which I named as standard, it contains 400 phrases sorted in alphabetical order. Then I have another file that contains lets say 1000 sentences, I want to cut this sentences into words, then do the comparison.
    e.g. in the sentences I there is the word "excellent" , I want to take that word, and look if there is any phrase in my array that begins...
    See more | Go to post

    Leave a comment:


  • stealwings
    started a topic LinearSearch to BinarySearch
    in C

    LinearSearch to BinarySearch

    I have this code that does a linear search within two files, but it is too slow......
    Code:
    	
    for(unsigned i=0;i<Standard.size();i++) 
    { 
      for(unsigned j=0;j<MyWords.size();j++)  //each MyWords compare to the Standard 
    					                  //and see if it is in the standard vector
    		{
    			string::size_type FoundAt=MyWords[i].find(Standard[j]);
    			while( string::npos != FoundAt )
    ...
    See more | Go to post

  • stealwings
    replied to Compare text and replace!
    in C
    There isn't any body who can give me hand in this problem yet? Or shall I star a new discussions for my question to be answered?
    See more | Go to post

    Leave a comment:


  • stealwings
    replied to Using C++ header files in C application
    in C
    IC, thx for your explanation Banfa. I now get to know a little bit more than b4.
    See more | Go to post

    Leave a comment:


  • stealwings
    replied to How to populate an array
    in C
    take a look at this page it will help you to find out array and strings...
    See more | Go to post
    Last edited by Banfa; Mar 15 '07, 08:52 AM. Reason: correcting link

    Leave a comment:


  • stealwings
    replied to Using C++ header files in C application
    in C
    Ehmmmm, shouldn't the headers of c++ be like "header.h"? And I think that you will have to do a lot of modifications in that header to include it to your c program since C++ is more advanced than C, in other words C++ can compile C files, but it may not work in vice versa....
    See more | Go to post

    Leave a comment:


  • stealwings
    replied to hellow
    in C
    ........ did you try to write something yourself? Can you post it and say where did you get stuck?
    See more | Go to post

    Leave a comment:


  • stealwings
    replied to Compare text and replace!
    in C
    Sorry if the last post for my question was too long, maybe a little example of what I'm looking for will be easier to be understand.
    e.g. Lets say I have a sentences "This world is full of beauty!" and I have in my sorted array the phrase "full of beauty", I would like to take each word of the sentence to and compare it with my array like the following:
    1. Take the word "This", since it doesn't match delete...
    See more | Go to post

    Leave a comment:


  • stealwings
    replied to Compare text and replace!
    in C
    Hello everyone;
    I have a new question about this program that I couldn't solve myself yet. In the last post the function I use to search for my required word is too slow, takes at least a hundred years to finish comparing a large text, since it does a linear search. I know that using binary search it will speed up much much more, but here is where problem appears. To do a binary search I will need to cut the sentences...
    See more | Go to post

    Leave a comment:


  • stealwings
    replied to word count
    in C
    Sorry for the late reply, have been busy, this is the code I wrote so that all the char can be count and the gives you the sum of them so you can know how much space you will need to allocate them. Don't know if its the best way but at least it works.
    Code:
    	int count=0;
    	ReadWord.open("file.txt");
    	while(!ReadWord.eof())
    	{
    		ReadWord.getline(MyWord, MAXLENGTH);
    		count+=ReadWord.gcount();
    ...
    See more | Go to post

    Leave a comment:


  • stealwings
    replied to word count
    in C
    I think I've got it already sorry, but I couldn't delete the post.
    See more | Go to post

    Leave a comment:


  • stealwings
    replied to c discussion
    in C
    Just have a look at the for loop statementand you will find out how easy it is to do that
    See more | Go to post

    Leave a comment:


  • stealwings
    started a topic word count
    in C

    word count

    Hello everyone;
    I have this code to count the number of chars of every getline, now I was wonder if someone could tell me how can I get the sum of all the lines, I have tried for loop but since every time count is less than my ReadWord.gcount () all I get is an infinite loop, and I cannot use ReadWord.size() to get the Max size needed, can some one give me some hints plz? Thx in advance.
    Code:
    ReadWord.open("file.txt");
    ...
    See more | Go to post
No activity results to display
Show More
Working...