Search Results

Search found 2122 results on 85 pages for 'yoav str'.

Page 15/85 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • How can I split a Perl string only on the last occurrence of the separator?

    - by kiruthika
    Hi All, my $str="1:2:3:4:5"; my ($a,$b)=split(':',$str,2); In the above code I have used limit as 2 ,so $a will contain 1 and remaining elements will be in $b. Like this I want the last element should be in one variable and the elements prior to the last element should be in another variable. Example $str = "1:2:3:4:5" ; # $a should have "1:2:3:4" and $b should have "5" $str = "2:3:4:5:3:2:5:5:3:2" # $a should have "2:3:4:5:3:2:5:5:3" and $b should have "2"

    Read the article

  • Explicitly instantiating a generic member function of a generic structure

    - by Dennis Zickefoose
    I have a structure with a template parameter, Stream. Within that structure, there is a function with its own template parameter, Type. If I try to force a specific instance of the function to be generated and called, it works fine, if I am in a context where the exact type of the structure is known. If not, I get a compile error. This feels like a situation where I'm missing a typename, but there are no nested types. I suspect I'm missing something fundamental, but I've been staring at this code for so long all I see are redheads, and frankly writing code that uses templates has never been my forte. The following is the simplest example I could come up with that illustrates the issue. #include <iostream> template<typename Stream> struct Printer { Stream& str; Printer(Stream& str_) : str(str_) { } template<typename Type> Stream& Exec(const Type& t) { return str << t << std::endl; } }; template<typename Stream, typename Type> void Test1(Stream& str, const Type& t) { Printer<Stream> out = Printer<Stream>(str); /****** vvv This is the line the compiler doesn't like vvv ******/ out.Exec<bool>(t); /****** ^^^ That is the line the compiler doesn't like ^^^ ******/ } template<typename Type> void Test2(const Type& t) { Printer<std::ostream> out = Printer<std::ostream>(std::cout); out.Exec<bool>(t); } template<typename Stream, typename Type> void Test3(Stream& str, const Type& t) { Printer<Stream> out = Printer<Stream>(str); out.Exec(t); } int main() { Test2(5); Test3(std::cout, 5); return 0; } As it is written, gcc-4.4 gives the following: test.cpp: In function 'void Test1(Stream&, const Type&)': test.cpp:22: error: expected primary-expression before 'bool' test.cpp:22: error: expected ';' before 'bool' Test2 and Test3 both compile cleanly, and if I comment out Test1 the program executes, and I get "1 5" as I expect. So it looks like there's nothing wrong with the idea of what I want to do, but I've botched something in the implementation. If anybody could shed some light on what I'm overlooking, it would be greatly appreciated.

    Read the article

  • ActionScript find LineBreak in XML and count them

    - by Pepe Sanchez
    Hi, i have an XML that has line breaks like this: This is a text that has line breaks im reading that xml in action script.. and trying to count how many linebreaks are in the text. Here is my code.. it returns 0 , it should return 5 for the example. function countBreaks(str:String) : Number { var count:Number = 0; for (var i:Number = 0; i < str.length-1; i++) { if(str.charAt(i)+str.charAt(i+1) eq "\n") count++; } return count; } I appreciate any help :)

    Read the article

  • jQuery Form Processing With PHP to MYSQL Database Using $.ajax Request

    - by FrustratedUser
    Question: How can I process a form using jQuery and the $.ajax request so that the data is passed to a script which writes it to a database? Problem: I have a simple email signup form that when processed, adds the email along with the current date to a table in a MySQL database. Processing the form without jQuery works as intended, adding the email and date. With jQuery, the form submits successfully and returns the success message. However, no data is added to the database. Any insight would be greatly appreciated! <!-- PROCESS.PHP --> <?php // DB info $dbhost = '#'; $dbuser = '#'; $dbpass = '#'; $dbname = '#'; // Open connection to db $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); // Form variables $email = $_POST['email']; $submitted = $_POST['submitted']; // Clean up function cleanData($str) { $str = trim($str); $str = strip_tags($str); $str = strtolower($str); return $str; } $email = cleanData($email); $error = ""; if(isset($submitted)) { if($email == '') { $error .= '<p class="error">Please enter your email address.</p>' . "\n"; } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", $email)) { $error .= '<p class="error">Please enter a valid email address.</p>' . "\n"; } if(!$error){ echo '<p id="signup-success-nojs">You have successfully subscribed!</p>'; // Add to database $add_email = "INSERT INTO subscribers (email,date) VALUES ('$email',CURDATE())"; mysql_query($add_email) or die(mysql_error()); }else{ echo $error; } } ?> <!-- SAMPLE.PHP --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sample</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ // Email Signup $("form#newsletter").submit(function() { var dataStr = $("#newsletter").serialize(); alert(dataStr); $.ajax({ type: "POST", url: "process.php", data: dataStr, success: function(del){ $('form#newsletter').hide(); $('#signup-success').fadeIn(); } }); return false; }); }); </script> <style type="text/css"> #email { margin-right:2px; padding:5px; width:145px; border-top:1px solid #ccc; border-left:1px solid #ccc; border-right:1px solid #eee; border-bottom:1px solid #eee; font-size:14px; color:#9e9e9e; } #signup-success { margin-bottom:20px; padding-bottom:10px; background:url(../img/css/divider-dots.gif) repeat-x 0 100%; display:none; } #signup-success p, #signup-success-nojs { padding:5px; background:#fff; border:1px solid #dedede; text-align:center; font-weight:bold; color:#3d7da5; } </style> </head> <body> <?php include('process.php'); ?> <form id="newsletter" class="divider" name="newsletter" method="post" action=""> <fieldset> <input id="email" type="text" name="email" /> <input id="submit-button" type="image" src="<?php echo $base_url; ?>/assets/img/css/signup.gif" alt=" SIGNUP " /> <input id="submitted" type="hidden" name="submitted" value="true" /> </fieldset> </form> <div id="signup-success"><p>You have successfully subscribed!</p></div> </body> </html>

    Read the article

  • Why is win32com so much slower than xlrd?

    - by Josh
    I have the same code, written using win32com and xlrd. xlrd preforms the algorithm in less than a second, while win32com takes minutes. Here is the win32com: def makeDict(ws): """makes dict with key as header name, value as tuple of column begin and column end (inclusive)""" wsHeaders = {} # key is header name, value is column begin and end inclusive for cnum in xrange(9, find_last_col(ws)): if ws.Cells(7, cnum).Value: wsHeaders[str(ws.Cells(7, cnum).Value)] = (cnum, find_last_col(ws)) for cend in xrange(cnum + 1, find_last_col(ws)): #finds end column if ws.Cells(7, cend).Value: wsHeaders[str(ws.Cells(7, cnum).Value)] = (cnum, cend - 1) break return wsHeaders And the xlrd def makeDict(ws): """makes dict with key as header name, value as tuple of column begin and column end (inclusive)""" wsHeaders = {} # key is header name, value is column begin and end inclusive for cnum in xrange(8, ws.ncols): if ws.cell_value(6, cnum): wsHeaders[str(ws.cell_value(6, cnum))] = (cnum, ws.ncols) for cend in xrange(cnum + 1, ws.ncols):#finds end column if ws.cell_value(6, cend): wsHeaders[str(ws.cell_value(6, cnum))] = (cnum, cend - 1) break return wsHeaders

    Read the article

  • Using a function with reference as a function with pointers?

    - by epatel
    Today I stumbled over a piece of code that looked horrifying to me. The pieces was chattered in different files, I have tried write the gist of it in a simple test case below. The code base is routinely scanned with FlexeLint on a daily basis, but this construct has been laying in the code since 2004. The thing is that a function implemented with a parameter passing using references is called as a function with a parameter passing using pointers...due to a function cast. The construct has worked since 2004 on Irix and now when porting it actually do work on Linux/gcc too. My question now. Is this a construct one can trust? I can understand if compiler constructors implement the reference passing as it was a pointer, but is it reliable? Are there hidden risks? Should I change the fref(..) to use pointers and risk braking anything in the process? What to you think? #include <iostream> using namespace std; // ---------------------------------------- // This will be passed as a reference in fref(..) struct string_struct { char str[256]; }; // ---------------------------------------- // Using pointer here! void fptr(const char *str) { cout << "fptr: " << str << endl; } // ---------------------------------------- // Using reference here! void fref(string_struct &str) { cout << "fref: " << str.str << endl; } // ---------------------------------------- // Cast to f(const char*) and call with pointer void ftest(void (*fin)()) { void (*fcall)(const char*) = (void(*)(const char*))fin; fcall("Hello!"); } // ---------------------------------------- // Let's go for a test int main() { ftest((void (*)())fptr); // test with fptr that's using pointer ftest((void (*)())fref); // test with fref that's using reference return 0; }

    Read the article

  • How can I prevent SerializeJSON from changing Yes/No/True/False strings to boolean?

    - by Dan Roberts
    I have a data struct being stored in JSON format, converted using the serializeJSON function. The problem I am running into is that strings that can be boolean in CF such as Yes,No,True,and False are converted into JSON as boolean values. Below is example code. Any ideas on how to prevent this? Code: <cfset test = {str='Yes'}> <cfset json = serializeJSON(test)> <cfset fromJSON = deserializeJSON(json)> <cfoutput> #test.str#<br> #json#<br> #fromJSON.str# </cfoutput> Result: Yes {"STR":true} YES

    Read the article

  • Fastest way to put contents of Set<String> to a single String with words separated by a whitespace?

    - by Lars Andren
    I have a few Set<String>s and want to transform each of these into a single String where each element of the original Set is separated by a whitespace " ". A naive first approach is doing it like this Set<String> set_1; Set<String> set_2; StringBuilder builder = new StringBuilder(); for (String str : set_1) { builder.append(str).append(" "); } this.string_1 = builder.toString(); builder = new StringBuilder(); for (String str : set_2) { builder.append(str).append(" "); } this.string_2 = builder.toString(); Can anyone think of a faster, prettier or more efficient way to do this?

    Read the article

  • Why can't pass Marshaled interface as integer(or pointer)

    - by cemick
    I passed ref of interface from Visio Add-ins to MyCOMServer (http://stackoverflow.com/questions/2455183/interface-marshalling-in-delphi).I have to pass interface as pointer in internals method of MyCOMServer. I try to pass interface to internal method as pointer of interface, but after back cast when i try call method of interface I get exception. Simple example(Fisrt block execute without error, but At Second block I get Exception after addressed to property of IVApplication interface): procedure TMyCOMServer.test(const Interface_:IDispatch); stdcall; var IMy:_IMyInterface; V: Variant; Str: String; I: integer; Vis: IVApplication; begin ...... Self.QuaryInterface(_IMyInterface,IMy); str := IA.ApplicationName; V := Integer(IMy); i := V; Pointer(IMy) := Pointer(i); str := IMy.SomeProperty; // normal completion str := (Interface_ as IVApplication).Path; V := Interface_; I := V; Pointer(Vis) := Pointer(i); str := Vis.Path; // 'access violation at 0x76358e29: read of address 0xfeeefeee' end; Why I can't do like this?

    Read the article

  • Removing a character from a string

    - by Prasanth Madhavan
    i have a string. I want to delete the last character of the string if it is a space. i tried the following code, str.erase(remove_if(str.begin(), str.end(), isspace), str.end()); but my g++ compiler gives me an error saying: error: no matching function for call to ‘remove_if(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, <unresolved overloaded function type>)’ please help.

    Read the article

  • Reading POST data from html form sent to serversocket.

    - by user32167
    i try to write simplest possible server app in Java, displaying html form with textarea input, which after submitting gives me possibility to parse xml typed in that textarea. For now i build simple serversocket based server like that: import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; public class WebServer { protected void start() { ServerSocket s; String gets = ""; System.out.println("Start on port 80"); try { // create the main server socket s = new ServerSocket(80); } catch (Exception e) { System.out.println("Error: " + e); return; } System.out.println("Waiting for connection"); for (;;) { try { // wait for a connection Socket remote = s.accept(); // remote is now the connected socket System.out.println("Connection, sending data."); BufferedReader in = new BufferedReader(new InputStreamReader( remote.getInputStream())); PrintWriter out = new PrintWriter(remote.getOutputStream()); String str = "."; while (!str.equals("")) { str = in.readLine(); if (str.contains("GET")){ gets = str; break; } } out.println("HTTP/1.0 200 OK"); out.println("Content-Type: text/html"); out.println(""); // Send the HTML page String method = "get"; out.print("<html><form method="+method+">"); out.print("<textarea name=we></textarea></br>"); out.print("<input type=text name=a><input type=submit></form></html>"); out.println(gets); out.flush(); remote.close(); } catch (Exception e) { System.out.println("Error: " + e); } } } public static void main(String args[]) { WebServer ws = new WebServer(); ws.start(); } } After form (textarea with xml and one additional text input) is submitted in 'gets' String-type variable I have Urlencoded values of my variables (also displayed on the screen, it looks like that: gets = GET /?we=%3Cnetwork+ip_addr%3D%2210.0.0.0%2F8%22+save_ip%3D%22true%22%3E%0D%0A%3Csubnet+interf_used%3D%22200%22+name%3D%22lan1%22+%2F%3E%0D%0A%3Csubnet+interf_used%3D%22254%22+name%3D%22lan2%22+%2F%3E%0D%0A%3C%2Fnetwork%3E&a=fooBar HTTP/1.1 What can i do to change GET to POST method (if i simply change it in form and than put " if (str.contains("POST")){" it gives me string like gets = POST / HTTP/1.1 with no variables. And after that, how i can use xml from my textarea field (called 'we')?

    Read the article

  • unicode data with custom font doesn't work properly in ipad

    - by David Ohanyan
    I am using custom font for label and string which I am getting from unicode characters. And the font is not changing. here is the snippet of my code: NSString* str = @"\u05D0\u05D1\u05D2"; [mMatchingLabel setText:str]; mMatchingLabel.font = [UIFont fontWithName:@"David New Hebrew" size:26]; But when I write for example : NSString* str = @"label"; [mMatchingLabel setText:str]; mMatchingLabel.font = [UIFont fontWithName:@"David New Hebrew" size:26]; The font effect is evident. Can someone explain what's here wrong?

    Read the article

  • What's the fastest way to check if a word from one string is in another string?

    - by Mike Trpcic
    I have a string of words; let's call them bad: bad = "foo bar baz" I can keep this string as a whitespace separated string, or as a list: bad = bad.split(" "); If I have another string, like so: str = "This is my first foo string" What's the fasted way to check if any word from the bad string is within my comparison string, and what's the fastest way to remove said word if it's found? #Find if a word is there bad.split(" ").each do |word| found = str.include?(word) end #Remove the word bad.split(" ").each do |word| str.gsub!(/#{word}/, "") end

    Read the article

  • convert int to string for use in allegro function

    - by ace
    I am trying to run the following code using allegro. textout_ex(screen, font, numbComments , 100, 100, GREEN, BLACK); numbComments is an integer, the function prototype of this function is void textout_ex(BITMAP *bmp, const FONT *f, const char *s, int x, int y, int color, int bg); and i cannot, according to my understanding pass this integer in the third position. I therefore need to convert the integer into a string. I did it like this, but it didnt work. Help please? int score = numbComments; string Str; stringstream out; // YOU MUST INCLUDE <sstream> FOR THIS. out << score; Str = out.str(); and then tried to use the string Str, which didnt work

    Read the article

  • Should I return an NSMutableString in a method that returns NSString

    - by Casey Marshall
    Ok, so I have a method that takes an NSString as input, does an operation on the contents of this string, and returns the processed string. So the declaration is: - (NSString *) processString: (NSString *) str; The question: should I just return the NSMutableString instance that I used as my "work" buffer, or should I create a new NSString around the mutable one, and return that? So should I do this: - (NSString *) processString: (NSString *) str { NSMutableString *work = [NSMutableString stringWithString: str]; // process 'work' return work; } Or this: - (NSString *) processString: (NSString *) str { NSMutableString *work = [NSMutableString stringWithString: str]; // process 'work' return [NSString stringWithString: work]; // or [work stringValue]? } The second one makes another copy of the string I'm returning, unless NSString does smart things like copy-on-modify. But the first one is returning something the caller could, in theory, go and modify later. I don't care if they do that, since the string is theirs. But are there valid reasons for preferring the latter form over the former? And, is either stringWithString or stringValue preferred over the other?

    Read the article

  • Socket.recv works but not gets or read?

    - by Earlz
    Hello I've been messing around with Sockets in Ruby some and came across some example code that I tried modifying and broke. I want to know why it's broken. Server: require "socket" dts = TCPServer.new('127.0.0.1', 20000) loop do Thread.start(dts.accept) do |s| print(s, " is accepted\n") s.write(Time.now) print(s, " is gone\n") s.close end end Client that works: require 'socket' streamSock = TCPSocket.new( "127.0.0.1", 20000 ) streamSock.print( "Hello\n" ) str = streamSock.recv( 100 ) print str streamSock.close Client that is broken require 'socket' streamSock = TCPSocket.new( "127.0.0.1", 20000 ) streamSock.print( "Hello\n" ) str=streamSock.read #this line modified print str streamSock.close I know that the streamSock.print is unnecessary (as well as the naming scheme being non-ruby) but I don't understand why read doesn't work while recv does, Why is this?

    Read the article

  • why is internet explorer displaying my javascript pagination backwards?

    - by user278457
    Here's a version of the code I'm using, stripped down to just the parts that aren't working. This is all written to generate some basic pagination with jQuery. In Chrome/Safari/Moz, I generate see spans, 1,2,3,4,...,etc When I look in IE7/8, I see etc,...,4,3,2,1 The string seems to be concatenating backwards!! This seems very strange to me, because there's not a whole lot going on in the code here, I can't figure out which bit could be causing problems. Obviously, the 1,2,3,4,...,etc is what I'm aiming for here, so as well as an explanation of why this is an issue, I'd love it if someone could offer a quick fix. myVar = { arr:$.makeArray($('.my_li')) }; var str; str=''; for (s in myVar.arr){ r=parseInt(s,10)+1; str+='<span class="my_class">'+r+'</span>'; } $('#my_other_div').html(str);

    Read the article

  • jQuery sortColumns plugin: How to sort correctly with rowspan

    - by Thang Pham
    Following this post jQuery table sort (github link: https://github.com/padolsey/jQuery-Plugins/blob/master/sortElements/jquery.sortElements.js), I am successfully sort columns, however it does not work in the case of rowspan: For example, case like this Grape 3,096,671M 1,642,721M Apple 2,602,750M 3,122,020M When I click on the second column, it try to sort Apple 2,602,750M 1,642,721M Grape 3,096,671M 3,122,020M which as you can see is not correct, please any jQuery guru help me fix this problem. Here is my code var inverse = false; function sortColumn(index){ index = index + 1; var table = jQuery('#resultsTable'); table.find('td').filter(function(){ return jQuery(this).index() == index; }).sortElements(function(a, b){ a = convertToNum($(a).text()); b = convertToNum($(b).text()); return ( isNaN(a) || isNaN(b) ? a > b : +a > +b ) ? inverse ? -1 : 1 : inverse ? 1 : -1; },function(){ return this.parentNode; }); inverse = !inverse; } function convertToNum(str){ if(isNaN(str)){ var holder = ""; for(i=0; i<str.length; i++){ if(!isNaN(str.charAt(i))){ holder += str.charAt(i); } } return holder; }else{ return str; } } Question: 1.How do I sort this with rowspan. THE NUMBER OF ROWSPAN IS NOT ALWAYS THE SAME. The above example both Grape and Apple have rowspan of 2, but this is not always the case. 2.Can any explain this syntax: return ( isNaN(a) || isNaN(b) ? a > b : +a > +b ) ? inverse ? -1 : 1 : inverse ? 1 : -1; So I can see that if either a or b is not a number, then do string comparison otherwise do number comparison, but I dont understand the inverse ? -1 : 1 : inverse ? 1 : -1;

    Read the article

  • Problem of using cin twice.

    - by gc
    Here is the code: string str; cinstr; cout<<"first input:"<<str<<endl; getline(cin, str); cout<<"line input:"<<str<<endl; The result is that getline never pauses for user input, therefore the second output is always empty. After spending some time on it, I realized after the first call "cinstr", it seems '\n' is still stored in cin (using cin.peek() to check), which ends getline immediately. The solution will be adding one more line between the first usage and the second one: cin.ignore(numeric_limits::max(), '\n'); However, I still don't understand, why is '\n' left there after the first call? What does istream& operator really do?

    Read the article

  • C++ Check Substring of a String

    - by user69514
    I'm trying to check whether or not the second argument in my program is a substring of the first argument. The problem is that it only work if the substring starts with the same letter of the string. .i.e Michigan - Mich (this works) Michigan - Mi (this works) Michigan - igan (this doesn't work) #include <stdio.h> #include <string.h> #include <string> using namespace std; bool my_strstr( string str, string sub ) { bool flag = true; int startPosition = -1; char subStart = str.at(0); char strStart; //find starting position for(int i=0; i<str.length(); i++){ if(str.at(i) == subStart){ startPosition = i; break; } } for(int i=0; i<sub.size(); i++){ if(sub.at(i) != str.at(startPosition)){ flag = false; break; } startPosition++; } return flag; } int main(int argc, char **argv){ if (argc != 3) { printf ("Usage: check <string one> <string two>\n"); } string str1 = argv[1]; string str2 = argv[2]; bool result = my_strstr(str1, str2); if(result == 1){ printf("%s is a substring of %s\n", argv[2], argv[1]); } else{ printf("%s is not a substring of %s\n", argv[2], argv[1]); } return 0; }

    Read the article

  • How to share a variable between two classes?

    - by Altefquatre
    How would you share the same object between two other objects? For instance, I'd like something in that flavor: class A { private string foo_; // It could be any other class/struct too (Vector3, Matrix...) public A (string shared) { this.foo_ = shared; } public void Bar() { this.foo_ = "changed"; } } ... // inside main string str = "test"; A a = new A(str); Console.WriteLine(str); // "test" a.Bar(); Console.WriteLine(str); // I get "test" instead of "changed"... :( I read there is some ref/out stuff, but I couldn't get what I'm asking here. I could only apply some changes in the methods scope where I was using ref/out arguments... I also read we could use pointers, but is there no other way to do it?

    Read the article

  • Determine if a string contains only alphanumeric characters (or a space)

    - by dreamlax
    I'm learning C++ and I am writing a function that determines whether a string contains only alphanumeric characters and spaces. I suppose I am effectively testing whether it matches the regular expression ^[[:alnum:] ]+$ but without using regular expressions. I have seen a lot of algorithms revolve around iterators, so I tried to find a solution that made use of iterators, and this is what I have: #include <algorithm> static inline bool is_not_alnum_space(char c) { return !(isalpha(c) || isdigit(c) || (c == ' ')); } bool string_is_valid(const std::string &str) { return find_if(str.begin(), str.end(), is_not_alnum_space) == str.end(); } Is there a better solution, or a “more C++” way to do this?

    Read the article

  • Jakarta Regexp 1.5 Backreferences?

    - by Matt Smith
    Why does this match: String str = "099.9 102.2" + (char) 0x0D; RE re = new RE("^([0-9]{3}.[0-9]) ([0-9]{3}.[0-9])\r$"); System.out.println(re.match(str)); But this does not: String str = "099.9 102.2" + (char) 0x0D; RE re = new RE("^([0-9]{3}.[0-9]) \1\r$"); System.out.println(re.match(str)); The back references don't seem to be working... What am I missing?

    Read the article

  • struct and rand()

    - by teoz
    I have a struct with an array of 100 int (b) and a variable of type int (a) I have a function that checks if the value of "a" is in the array and i have generated the array elements and the variable with random values. but it doesn't work can someone help me fix it? #include <stdio.h> #include <stdlib.h> #include <time.h> typedef struct { int a; int b[100]; } h; int func(h v){ int i; for (i=0;i<100;i++){ if(v.b[i]==v.a) return 1; else return 0; } } int main(int argc, char** argv) { h str; srand(time(0)); int i; for(i=0;0<100;i++){ str.b[i]=(rand() % 10) + 1; } str.a=(rand() % 10) + 1; str.a=1; printf("%d\n",func(str)); return 0; }

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >