When I execute the program and I enter C or F and complete the process, this is the image of what I see:    I want to hide the line in the red rectangle. This is the code I have:  #include &lt;stdio.h&gt;  int main(void){     float f,c;     char var;     int x;      while(var!='x'){         printf("x=Ende c=Umrechnung c-&gt;f f=Umrechnung f-&gt;c:");         scanf("%c",&amp;var);         if(var=='c'){             printf("Grad Celsius =");             scanf("%f",&amp;c);             f=(c*1.8)+32;             printf("%.2f Grad Celsius sind %.2f Grad Fahrenheit\n",c,f);         }         else if(var=='f'){             printf("Grad Fahrenheit =");             scanf("%f",&amp;f);             c=(f-32)/1.8;             printf("%.2f Grad Fahrenheit sind %.2f Grad Celsius\n",f,c);         }         else if(var=='x'){             printf("fertig !! chao\n");         }         else {             printf("Ungiltige Umreechnungsart!!\n");         }     }     return 0; }
11109
I've been having a lot of problems trying to figure out how to use scanf().  It seems to work fine with integers, being fairly straight forward scanf("%d", &amp;i).  Where I am running into issues is using scanf() in loops trying to read input.  For example:  do {   printf("counter: %d: ", counter);   scanf("%c %c%d", &amp;command, &amp;prefix, &amp;input); } while (command != 'q');    When I enter in a validly structured input like c P101, it seems to loop again before prompting me.  This seems to happen even with a single:  scanf("%c", &amp;c)    in a while loop.  It'll do the loop twice before prompting me again.  What is making it loop twice, and how do I stop it? When I enter in less amount of input that programmatically wouldn't have another character or number such as q, pressing enter seems to prompt me to enter more.  How do I get scanf() to process both single and double character entries?
63994
I am trying to locate the vertices of a rectangle and to color the rectangular region.  I specify the y-coordinate as a function value, like \sqrt{3}/2 or \sin(60).  I am getting an error.  \documentclass{amsart} \usepackage{tikz} \usetikzlibrary{calc}   \begin{document} \begin{tikzpicture}  \coordinate (A) at (-1,{-\sqrt{3}/2}); \coordinate (B) at (-1,{\sin(60)}); \coordinate (C) at (2,{\sin(60)); \coordinate (D) at (2,{-\sqrt{3}/2});  \path[fill=yellow] (A) -- (B) -- (C) -- (D) -- cycle;  \node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]below left:$A$}] at (A) {}; \node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]above left:$B$}] at (B) {}; \node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]above right:$C$}] at (C) {}; \node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]below right:$D$}] at (D) {}; \end{tikzpicture}
59514
My code is   \documentclass{standalone} \usepackage{pgf-umlcd}  \renewcommand{\unidirectionalAssociation}[4] {   draw[umlcd style, -&gt;] (#1) -- (#4)   node[near end, auto]{#2}   node[near end, auto,swap]{#3}; }  \begin{document} \begin{tikzpicture}    \begin{abstractclass}[text width = 6cm]{FileStore}{0,0}     \attribute{$\sim$ com.alhelal.textpad}     \operation{+ orderFile(file : File) : EditableFile}      \operation[0]{\# createFile(file : File) : EditableFile}   \end{abstractclass}    \begin{class}[text width = 6cm,anchor = west,xshift = 5cm]{ProgrammFileFactory}{FileStore.east}     \inherit{FileStore}     \attribute{$\sim$ com.alhelal.textpad}     \operation{+ orderFile(file : File) : EditableFile}    \end{class}    \begin{class}[text width = 11cm, yshift = -2cm]{EditableFile}{ProgrammFileFactory.south}     \attribute{$\sim$ com.alhelal.textpad}     \attribute{+ languageBehavior : LanguageBehavior}      \operation{+ options : Options}      \operation{+ getCodeAreaFromTab(tb : Tab) : CodeArea}      \operation{+ saveFile(fileTabArrayList : ArrayList$&lt;$FileTab$&gt;$, option : Options)}     \operation{+ printFile(node : Node)}     \operation{+ toggleLineNumber(cd : CodeArea)}     \operation{+ setLanguageBehavior(langBehavior : LanguageBehavior)}     \operation{+ performRunCode(file : File)}     \operation{+ performBuildCode(file : File)}     \operation{+ performSetHighlightableText()}     \operation{+ performSetAutocompletableText()}   \end{class}    \begin{class}[text width = 3.5cm,anchor=north east,yshift = -2cm, xshift=-6cm]{TextFile}{EditableFile.south west}     \inherit{EditableFile}     \attribute{$\sim$ com.alhelal.textpad}   \end{class}    \begin{class}[text width = 3.5cm,anchor=north east,yshift = -2cm, xshift = -1.5cm]{CFile}{EditableFile.south west}     \inherit{EditableFile}     \attribute{$\sim$ com.alhelal.textpad}     \attribute{-path : String}   \end{class}    \begin{class}[text width=3.5cm,anchor=north west,yshift = -2cm,xshift=-3cm]{CplusFile}{EditableFile.south}     \inherit{EditableFile}     \attribute{$\sim$ com.alhelal.textpad}   \end{class}    \begin{class}[text width  = 3.5cm, anchor = north west, yshift = -2cm, xshift = -4cm]{JavaFile}{EditableFile.south east}     \inherit{EditableFile}     \attribute{$\sim$ com.alhelal.textpad}   \end{class}    \begin{class}[text width = 3.5cm,yshift = -2cm,xshift = 1cm]{PythonFile}{EditableFile.south east}     \inherit{EditableFile}     \attribute{$\sim$ com.alhelal.textpad}   \end{class}    \begin{class}[text width = 3.5cm, anchor = north west, yshift =-2cm,xshift = 5cm]{LaTeXFile}{EditableFile.south east}     \inherit{EditableFile}     \attribute{$\sim$ com.alhelal.textpad}   \end{class}   \unidirectionalAssociation{ProgrammFileFactory}{}{$&lt;&lt;$instantiate$&gt;&gt;$}{EditableFile}   \node [above=3mm] at (current bounding box.north) {Factory Method Pattern} \end{tikzpicture} \end{document}   I run this using pdflatex in terminal that results in
10087
I'd like to output hello world over 20 characters.  printf "%-20s :\n\n" 'hello world!!'  # Actual output hello world!!        :  # Wanted output hello world!!========:   However, I don't want to complete with spaces but with "=" instead. How do I do that?
19022
I have something like this:  \usepackage{algorithm} \usepackage{algpseudocode}  ... \begin{document} \begin{algorithm}[H] \begin{algorithmic}[1] \Function {function}{a} \State a = a + 1 \EndFunction \end{algorithmic} \end{algorithm} \end{document}   I'm using [H] because I want to set the position of my code. But after doing that a space for caption appears and I don't want it and now there are to horizontal lines beafore my code. You can see what I mean in this picture:   How can I remove one of those lines?  Thanks!
93317
I'm learning how to write programs in C using the k&amp;r book (The C Programming Language) and I have a problem with one of the exercises. It's asking me to detect and remove a character in string s1, which matches any characters in the string s2.  So, say s1 = "A";  And s2 = "AABAACAADAAE"  I want it to return "BCDE"  I know I'm on the right path towards it, i just don't know how to design programs very well, could you give me any additional tips. I tried to read about the binary search tree algorithm, but felt it was a little too advanced for this mundane task.  Thanks everyone!  /* An alternate version of squeeze(s1, s2) that deletes each character in  * s1 that matches any character in the string s2  *  * Angie@odfx.org  */  #include &lt;stdio.h&gt; #include &lt;string.h&gt;  void squeeze(char s[], char t[]);  char string[] = "BAD"; char sstring[] = "ABC";  int main(void) {     squeeze(string, sstring);     return 0; }  void squeeze(char s[], char t[]) {     int i, j, d;      d = 0;     if(strstr(s, t) == NULL)         printf("%c", s[i]);     s[j] = '\0'; }
65182
\[\setlength\arraycolsep{1pt} \begin{array}{rcccl}     &amp;S &amp;= &amp;R_0 + R_1 + R_2 + R_3 + R_4 &amp;+ \\     &amp;  &amp;~ &amp;R_5 + R_6 + R_7 + R_8 + R_9 &amp;~ \\     &amp;  &amp;= &amp;0   +  1  +  2  +  3  +  4  &amp;~ \\     &amp;  &amp;~ &amp;5   +  6  +  7  +  8  +  9  &amp;= 45 &lt; 100 \end{array} \]   generates:    with = signs being correctly aligned. How to make + symbols aligned? Adding extra &amp; signs in front of +:  &amp;S &amp;= &amp;R_0 &amp;+ R_1 + R_2 + R_3 + R_4 &amp;+ \\ &amp;  &amp;~ &amp;R_5 &amp;+ R_6 + R_7 + R_8 + R_9 &amp;~ \\ &amp;  &amp;= &amp;0   &amp;+  1  +  2  +  3  +  4  &amp;~ \\ &amp;  &amp;~ &amp;5   &amp;+  6  +  7  +  8  +  9  &amp;= 45 &lt; 100   gives compile error. Why?
13418
Is there a way to include an entire text file as a string in a C program at compile-time?  something like:   file.txt:  This is a little text file  main.c:  #include &lt;stdio.h&gt; int main(void) {    #blackmagicinclude("file.txt", content)    /*    equiv: char[] content = "This is\na little\ntext file";    */    printf("%s", content); }    obtaining a little program that prints on stdout "This is a little text file"  At the moment I used an hackish python script, but it's butt-ugly and limited to only one variable name, can you tell me another way to do it?
6734
While executing a C program, a.out, using the Ubuntu terminal, why do I always need to type ./ before a.out, instead of just writing a.out? Is there solution for this?
111231
What is the best way to draw a variable width line without using glLineWidth?  Just draw a rectangle?  Various  parallel lines? None of the above?
56379
I'm writing a wrapper class for a command line executable.  This exe accepts input from stdin until I hit Ctrl+C in the command prompt shell, in which case it prints output to stdout based on the input.  I want to simulate that Ctrl+C press in C# code, sending the kill command to a .NET Process object.  I've tried calling Process.Kill(), but that doesn't seem to give me anything in the process's StandardOutput StreamReader.  Might there be anything I'm not doing right?  Here's the code I'm trying to use:  ProcessStartInfo info = new ProcessStartInfo(exe, args); info.RedirectStandardError = true; info.RedirectStandardInput = true; info.RedirectStandardOutput = true; info.UseShellExecute = false; Process p = Process.Start(info);  p.StandardInput.AutoFlush = true; p.StandardInput.WriteLine(scriptcode);  p.Kill();  string error = p.StandardError.ReadToEnd(); if (!String.IsNullOrEmpty(error))  {     throw new Exception(error); } string output = p.StandardOutput.ReadToEnd();   The output is always empty, even though I get data back from stdout when I run the exe manually.  Edit: This is C# 2.0 by the way.
105267
Is it possible to dereference a void pointer without type-casting in the C programming language?  Also, is there any way of generalizing a function which can receive a pointer and store it in a void pointer and by using that void pointer, can we make a generalized function?  for e.g.:  void abc(void *a, int b) {    if(b==1)       printf("%d",*(int*)a);     // If integer pointer is received    else if(b==2)       printf("%c",*(char*)a);     // If character pointer is received    else if(b==3)       printf("%f",*(float*)a);     // If float pointer is received }   I want to make this function generic without using if-else statements - is this possible?   Also if there are good internet articles which explain the concept of a void pointer, then it would be beneficial if you could provide the URLs.  Also, is pointer arithmetic with void pointers possible?
91407
Ii am writing a short code, so I doubt anything else in the code is causing the problem. This is the problematic line of code:  \[ M_R := \max {|f(z)|: |z - z_0| = R }\le M\]   It doesn't show the curly braces. I've tried using \left{ and \right} but to no avail.  What should I do?  Thank you
6517
I have a graph. This is my code.    \documentclass[10pt]{article}     \usepackage{pgf,tikz}     \usetikzlibrary{arrows,patterns}     \pagestyle{empty}      \definecolor{ttqqcc}{rgb}{0.2,0,0.8}     \definecolor{ffqqtt}{rgb}{1,0,0.2}     \definecolor{ttqqff}{rgb}{0.2,0,1}     \definecolor{uququq}{rgb}{0.25,0.25,0.25}      \begin{document}      \begin{tikzpicture}[line cap=round,line join=round,&gt;=triangle 45,x=1.0cm,y=1.0cm]      \draw[-&gt;] (-3.63,0) -- (3.67,0);     \foreach \x in {-3,-2,-1,1,2,3}       \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt)          node[below] {\footnotesize $\x$};     \draw[color=black] (3.48,0.07) node [anchor=south west] { $x$};      \draw[-&gt;] (0,-1.93) -- (0,5.57);     \foreach \y in {-1,1,2,3,4,5}       \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt)          node[left] {\footnotesize $\y$};     \draw[color=black] (0.06,5.19) node [anchor=west] { $y$};      \draw (0pt,-10pt) node[right] {\footnotesize $0$};      \clip(-3.63,-1.93) rectangle (3.67,5.57);     \draw[pattern color=ffqqtt,pattern=north east lines,fill opacity=0.1, smooth,samples=50,domain=0:1.0]      plot(\x,{\x^4-4*\x^2+3}) -- (1,0) -- (0,0) -- cycle;     \draw[pattern color=ttqqcc,pattern=crosshatch,fill opacity=0.1, smooth,samples=50,domain=1.0:1.7320508075688772]      plot(\x,{\x^4-4*\x^2+3}) -- (1.73,0) -- (1,0) -- cycle;      \begin{scope}[xscale=-1]     \draw[pattern color=ffqqtt,pattern=north east lines,fill opacity=0.1, smooth,samples=50,domain=0:1.0]        plot(\x,{\x^4-4*\x^2+3}) -- (1,0) -- (0,0) -- cycle;     \draw[pattern color=ttqqcc,pattern=crosshatch,fill opacity=0.1, smooth,samples=50,domain=1.0:1.7320508075688772]        plot(\x,{\x^4-4*\x^2+3}) -- (1.73,0) -- (1,0) -- cycle;     \end{scope}      \draw[smooth,samples=100,domain=-3.6342419080068153:3.665758091993186] plot(\x,{(\x)^4-4*(\x)^2+3});      \fill [color=uququq] (-1.73,0) circle (1.5pt);      \fill [color=uququq] (-1,0) circle (1.5pt);      \fill [color=uququq] (1,0) circle (1.5pt);      \fill [color=uququq] (1.73,0) circle (1.5pt);      \end{tikzpicture}     \end{document}   When I see the DVI output DVI, I have    And if I look at the PDF file, I have
89683
I wrote this program:  #include&lt;stdio.h&gt; int main() { printf(“Hello World\n”); return 0; }   I saved it as first.c and tried to compile but receiving this problem I have installed even gcc compiler too.  $ gcc first.c -o first1 first.c: In function ‘main’: first.c:4:1: error: stray ‘\342’ in program first.c:4:1: error: stray ‘\200’ in program first.c:4:1: error: stray ‘\234’ in program first.c:4:11: error: ‘Hello’ undeclared (first use in this function) first.c:4:11: note: each undeclared identifier is reported only once for each function  it appears in first.c:4:17: error: expected ‘)’ before ‘World’ first.c:4:17: error: stray ‘\’ in program first.c:4:17: error: stray ‘\342’ in program first.c:4:17: error: stray ‘\200’ in program first.c:4:17: error: stray ‘\235’ in program   How can I fix this problem?
18894
I'm just learning C with Kernighan and Ritchie's book; I'm in the basics of the fourth chapter (functions stuff). The other day I became curious about the sleep() function, so tried to use it like this:  #include &lt;stdio.h&gt; #include &lt;unistd.h&gt;  int main(void) {   printf(" I like cows.");   sleep(5);   return 0; }   The problem is the output of the program, it looks like it does the sleep() first and then the printf(), in other words, it waits five seconds and then prints the string. So I thought, maybe the program gets to sleep() so fast that it doesn't let printf() have his work done like I want, that is print the string and then sleep.  How can I show the string and then put the program to sleep? The compiler is GCC 3.3.5 (propolice) in OpenBSD 4.3.  PS I don't know how you put here the preprocessor lines correctly.
60149
Instead of the constrained 45 degrees that happens when you press C, is there a specific angle I can get for example 35 degrees instead?   It's currently cut at 45 degrees in the attached image and I need it to be 35.