find the flow charts of the given 'C' program 
Author Message
 find the flow charts of the given 'C' program

program 1
 to find the frequency of the given character in a given string
#include <stdio.h>
#include <conio.h>
main ()
{
char s[25],c,s;
int i,count;
count=0;
printf("enter the char");
c=getchar();
printf("enter the string");
scan f ("%s",s);
for(i=0;s[i]!='\0';i=i+1)
if (c==s[i])count=count+1;
print f ("the char%chas ocured on the string %s %dtimes",c,s,count);
getch ();

Quote:
}

program2 : to find the palindrome:
#include<stdio.h>
#include<conio.h>
#include<string.h>
main ()
{
clrscr();
int i,j;
char s1[25],s2[25];
scanf("%s",s1);
for(i=0;s[i]!='\0';i=i+1)
for(j=0;s[j]!='\0';j=j+1)
s2[j]=s1[i];
s2[j]!='\0';
if(strcop(s1,s2)==0) printf("palindrome");
else if printf("not palindrome");

Quote:
}

please send the following flowcharts within 20-30mins as i have to submit
this to my college.I'll keep checking till i get it

[please, folks, be gentile with him.  naivete like this is so precious. -mod]

                                   thanking u
                              hope u will do the needful matter. most      
                         urgent!  

                                      regards duke.

------------------  Posted via CNET Help.com  ------------------
                      http://www.*-*-*.com/
--



Fri, 29 Mar 2002 03:00:00 GMT  
 find the flow charts of the given 'C' program

[snip]

Quote:
>please send the following flowcharts within 20-30mins as i have to submit
>this to my college.I'll keep checking till i get it

>[please, folks, be gentile with him.  naivete like this is so precious. -mod]

     No problem, I'm not Jewish.

     Ah, Peter, indulge an old man's fancy and pretend that there is
an October.

[snip]

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
     I have preferences.
     You have biases.
     He/She has prejudices.
--



Sat, 30 Mar 2002 03:00:00 GMT  
 find the flow charts of the given 'C' program


Quote:
>program 1
> to find the frequency of the given character in a given string
>#include <stdio.h>
>#include <conio.h>
>main ()
>{
>char s[25],c,s;
>int i,count;
>count=0;
>printf("enter the char");
>c=getchar();
>printf("enter the string");
>scan f ("%s",s);
>for(i=0;s[i]!='\0';i=i+1)
>if (c==s[i])count=count+1;
>print f ("the char%chas ocured on the string %s %dtimes",c,s,count);
>getch ();
>}

What is your question?  The code won't compile for several reasons, and
even when you fix those it will still be bad code, not least because it
fails to use idiomatic C.

I cannot resist offering a fancy line:

for ( i = 0, s[i], ++i) count += (c==s[i]);

even if it isn't exactly idiomatic.
Francis Glassborow      Journal Editor, Association of C & C++ Users
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation
--



Sat, 30 Mar 2002 03:00:00 GMT  
 find the flow charts of the given 'C' program
And lo, there was much rejoicing amongst the people when duke

....snippage...
=> please send the following flowcharts within 20-30mins as i have to
submit
=> this to my college.I'll keep checking till i get it
=>
=> [please, folks, be gentile with him.

Is it Sunday again, already?   <g>

=> naivete like this is so precious. -mod]

I was just thinking the very same thing.   ];-)

C'ya,
RudeJohn  ];-)

http://www.quackwatch.com -- Quack Watch

http://home.ptd.net/~rudejohn/ -- RudeWare

http://home.ptd.net/~rudejohn/asefaqs.html -- The a.s.e. FAQs

"By eliminating editors, our networks demonstrate their importance.
There are plenty of writers on the Usenet, but few editors.
It shows." -- Clifford Stoll, 'Silicon Snake Oil'
--



Sat, 30 Mar 2002 03:00:00 GMT  
 find the flow charts of the given 'C' program

Quote:


>>[please, folks, be gentile with him.  naivete like this is so precious. -mod]
>     No problem, I'm not Jewish.

Urk.

What an amusingly awful typo?

Quote:
>     Ah, Peter, indulge an old man's fancy and pretend that there is
>an October.

The weird thing is, this *is* October.

-s
--

C/Unix wizard, Pro-commerce radical, Spam fighter.  Boycott Spamazon!
Will work for interesting hardware.  http://www.plethora.net/~seebs/
Visit my new ISP <URL:http://www.plethora.net/> --- More Net, Less Spam!
--



Sun, 31 Mar 2002 03:00:00 GMT  
 find the flow charts of the given 'C' program

You want to flow chart a couple of c programs.

In the C language, the types of statements that can redirect your flow are
if, for, while, do...while, goto, longjmp, and calling a function.

Assuming that you don't want to flowchart the internals of printf, scanf, or
getch, (whatever that is) your example only uses for and if, so let's
consider them.

To flowchart an if statement:

Suppose we have something like
if (x == y)
{
    z = 2;

Quote:
}

else
{
    z = 3;

Quote:
}

Its flowchart would look like:

<x = y ?>-----yes---->[ z = 2 ]----->(A)
  |
 no
  |
  V
[ z = 3 ]----->(A)

<> represents a diamond shaped box, [] represents a rectangular box, --> and
V are direction arrows.  (A) would be a circle labelled A where both paths
would merge.

To flowchart a for statement:

Suppose we have:
for (i=0; i < 10; ++i)
{
    x += i;

Quote:
}

Its flowchart would look like:

[ i = 0 ]--->(B)

(B)--><i < 10 ? >----yes--->[ x = x + i ]--->[ i = i + 1 ]---->(B)
           |
          no
           |
           V

Now you just need to plug in the specific code for your programs.
--



Sun, 31 Mar 2002 03:00:00 GMT  
 find the flow charts of the given 'C' program

[snip]

Quote:
>>     Ah, Peter, indulge an old man's fancy and pretend that there is
>>an October.

>The weird thing is, this *is* October.

     Midterms coming!

     I'm tutoring a student in Java now.  He's paying me.  What's
wrong with the rest of you?  <G>

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
     I have preferences.
     You have biases.
     He/She has prejudices.
--



Sun, 31 Mar 2002 03:00:00 GMT  
 find the flow charts of the given 'C' program



Quote:

> You want to flow chart a couple of c programs.

> In the C language, the types of statements that can redirect your flow are
> if, for, while, do...while, goto, longjmp, and calling a function.

I forgot switch.  I remembered it after sending
--



Sun, 31 Mar 2002 03:00:00 GMT  
 find the flow charts of the given 'C' program

Quote:



> >program 1
> > to find the frequency of the given character in a given string
> >#include <stdio.h>
> >#include <conio.h>
> >main ()
> >{
> >char s[25],c,s;
> >int i,count;
> >count=0;
> >printf("enter the char");
> >c=getchar();
> >printf("enter the string");
> >scan f ("%s",s);
> >for(i=0;s[i]!='\0';i=i+1)
> >if (c==s[i])count=count+1;
> >print f ("the char%chas ocured on the string %s %dtimes",c,s,count);
> >getch ();
> >}

> What is your question?  The code won't compile for several reasons, and
> even when you fix those it will still be bad code, not least because it
> fails to use idiomatic C.

> I cannot resist offering a fancy line:

> for ( i = 0, s[i], ++i) count += (c==s[i]);

> even if it isn't exactly idiomatic.

Or C.
Using the new typo-matic keyboard eh?

Anyway, on a more serious note - do I see a (vague) scanf?
He must be warned.
Type 25 (or more) characters in at the prompt, and wait for the smoke to
clear...

Phil
--
Phil Carmody
Not speaking for or on behalf of Nokia Telecommunications
--



Tue, 02 Apr 2002 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. find the flow charts of the given 'C' program

2. Program's flow depends on optimization

3. Looking for a program to produce flow charts of C source

4. Flow Chart Programs and Source Code scanners.

5. Need flow charting software for C programs

6. flow chart program

7. Flow Charting Program.

8. msvc 1.52, program not found 'cl'?

9. Trapping 'Windows Key' - More Information Given

10. Linker gives 'internal error'

11. HELP: I'm finding C programming tools for W98

12. where can i find resources on Window's Hooking programming?(NULL)

 

 
Powered by phpBB® Forum Software