Help, simple c++ code :S

Hi, so i've been trying to make a simple program that would print in the screen the char that i wrote in the first place...
i don't know why, but the following code isn't "printing".
#include "stdafx.h"
#include "stdio.h"
int main()
char l;
printf("insert char: ");
scanf_s("%c",&l);
printf("char: %c", l);
return 0;
Could someone please tell me what is wrong with the code, anything helps. Thanks.
Daniel Rangel

This is the Small Basic programming language forum - moving to C++.
However I think the reason is that the program shows your char input the ends - add a wait for key to see the output.
#include "stdafx.h"
#include "stdio.h"
int main()
char l;
printf("insert char: ");
scanf_s("%c", &l);
printf("char: %c", l);
scanf_s("%s", "press any key to exit...");
return 0;
As documented in
http://msdn.microsoft.com/en-us/library/w40768et.aspx, your call to scanf_s is missing a parameter.  I don't know if this will cause run-time problems or not.
Why are you including stdafx.h?
To insure that your output is sent to the screen, you should add a \n to your format string.  Otherwise the output could be buffered until the system has some other reason to send data.
To force the window to remain open until you have finished viewing the output (as currently coded it will close immediately), you could insert
     system("pause");
immediately before the return statement.  Remember to include stdlib.h if you do this.
When coding in C, you should use int main(void) instead of int main() but that is unlikely to affect a program such as this.

Similar Messages

  • Help with a simple pause-code function

    For a week I've been trying to figure out a simple pause-code
    function fror AS 3.0. I need something that pauses AS code for set
    amounts of time. People have tried to help me on this forum, but
    I've still not been able to make the code work.
    Here is what I have at the moment for pause-code (not
    working):
    var intID;
    intID = setInterval(delay, 3000); //this tells flash to wait
    3 seconds
    function delay(){
    clearInterval(intID);
    _root.gotoAndPlay(1); // or do something else...
    The person who supplied me with this code did not include the
    first line "var intID", but as a new flash user, I wasn't sure how
    else to declare intID. Could someone with some flash experience
    walk me through the steps of creating a pause-code function or add
    to the one I have already provided. When I use the above code in my
    flash document, the pause feature does not work at all. It
    essentially skips over the setInterval and clearInterval functions
    and plays the root clip in delay(). I need code meant for AS 3.0
    and I'm becoming increasingly desperate for a response.
    I hope this is understandable and thank you for taking a
    look,
    Sam

    Hello KGlad,
    Thankyou for that information. I had no idea lol. Could you
    please clarify and explain a little more about using the timer
    class to delay execution of code? Possibly provide an example? I
    would be very grateful.
    Thanks,
    Sam

  • Need Help With Simple ABAP Code

    Hello,
    I'm loading data from a DSO (ZDTBMAJ) to an Infocube (ZCBRAD06). I need help with ABAP code to some of the logic in Start Routine. DSO has 2 fields: ZOCTDLINX & ZOCBRDMAJ.
    1. Need to populate ZOCPRODCD & ZOCREFNUM fields in Infocube:
        Logic:-
        Lookup /BI0/PMATERIAL, if /BIC/ZOCBRDMAJ = /BIC/OIZOCBRDMAJ
        then /BIC/ZOCPRODCD = ZOCPRODCD in Infocube
               /BIC/ZOCREFNUM = ZOCREFNUM in Infocube         
    2. Need to populate 0G_CWWTER field in Infocube:
        Logic:
        Lookup /BIC/PZOCTDLINX, if /BIC/ZOCTDLINX = BIC/OIZOCTDLINX
        then G_CWWTER = 0G_CWWTER in Infocube.
    I would need to read single row at a time.
    Thanks!

    I resolved it.

  • Calling simple Java Code from 11g BPM

    Hi,
    I know this has been round the houses but I cant find a satisfactory solution for my scenario. I would like to call some simple java code from BPM (11.1.1.6). I guess I need to expose it as a service but it seems overkill to be via soap so any advice you can give would be much appreciated. Creating a jar that I can call somehow would be perfect.
    This is my scenario:
    - I am creating a Security POC for BPM
    - The BPM Process is exposed as a web service and authenticated using SAML
    - I am testing by calling the WS from OSB
    - I want to be able to get the WLS Principal and display the username and the roles for the launching user, from within the BPM process
    - This is possible using some simple weblogic client api code shown below
    - So all I want to do is call this code from BPM somehow
    - Anyone point me in the right direction ?
    cheers
    Tony
    subject = Security.getCurrentSubject();
    for(Principal p: subject.getPrincipals()) {
    if(p instanceof WLSGroupImpl) {
    groupList.add(p.getName());
    } else if (p instanceof WLSUser) {
    principal = p.getName();
    }

    The problem to communiate java classes and forms solved !
    i have add my .jar file to $OA_JAVA/oracle/apps/fnd/jar and now i can communicate between forms and java.
    I can create an object, i can get simple message from class, but when i try to create
    ServiceFactory factory = ServiceFactory.newInstance();
    ive got ORA-105100...
    can anybody help ?

  • Beginner needs help, simple do-while

    Need some help whit this code, how can I get this do-while loop to work?
    I use a simple gui where a decimal number is been read in, and some calculations beeing done.
    I want the user to decide if he/she wants to exit or not.
    But I dont now how I shall use it when using the boolean type.
    Tanks in advance.
    I'm sorry about my bad english!
    import mittBibliotek.*;
    class nettopris{
         static final double moms = 1.24;
         static final double rabatt = .85;
         public static void main (String[] args){
              do{
                   JavabokGUI gui = new JavabokGUI("Legger til moms");
                   gui.show();
                   double pris = gui.lesDesimaltall("","Skriv inn nettopris: ");
                   if (pris>2000){
                        double rabattPris=bergenNypris(pris);
                        double brutto = beregnBruttopris(rabattPris);
                        double rabattbel?p= beregnRabbattBel?p(pris,rabattPris);
                        gui.skrivResultater("Nettopris - 15% rabatt : " +rabattPris);
                        gui.skrivResultater("Prisen inkl. mva : " +brutto);
                        gui.skrivResultater("Rabatt bel?pet er : " +rabattbel?p);
                        gui.skrivResultater("Mva bel?pet er : "+beregnMvabel?p(brutto,rabattPris));
                   }else{
                        double brutto= beregnBruttopris(pris);
                        double avrundetPris= avrunding(brutto);
                        gui.skrivResultater("Prisen inkl mva (avrundet): " +avrundetPris);
                        gui.skrivResultater("Mva bel?pet er (avrundet): " +beregnMvabel?p(avrundetPris,pris));
                   }// end if else
                   boolean svar = gui.jaSvar("","Ny beregning? ");// GUI  yes/no.Where yes is true.If true looping until false
    }while  (svar == true) ;// error: cannot resolve symbol, variabel svar
         }// main
         static double beregnBruttopris(double prisen){
              double brutto= prisen * moms;
              return brutto;
         }//Brutto
         static double avrunding(double bruttopris){
              int avrundet= (int) (bruttopris + 0.5);
              return avrundet;
         }// Avrundet
         static double bergenNypris(double nyprisen){
              nyprisen = nyprisen * rabatt;
              return nyprisen;
         }// Nyprisen
         static double beregnRabbattBel?p(double pris, double rabatt){
              double rabbel?p = pris - rabatt;
              return rabbel?p;
         }// Rabatt bel?p
         static double beregnMvabel?p(double brutton, double rabattPrisen){
              double mvaBel?p = brutton - rabattPrisen;
              return mvaBel?p;
         }// Mvabel?p
    } // class nettopris

    If your only problem is with the variable svar, just put a line:
    boolean svar = true;before the "do" line and change the line:
    boolean svar = gui.jaSvar("","Ny beregning? ");to:
    svar = gui.jaSvar("","Ny beregning? ");Your problem has to do with variable scope. Since you declare the variable svar inside the braces {} of the do loop, it doesn't exist for the while test.

  • Search help for material code in VA01

    Dear Experts,
    In VA01 tcode in item level if user press f4 in the material code then we will get all the f4 helps for few fields.Now i need to add one more field  mtart from mara table  in the existing  search help of material code.
    plz suggest me how can i proceed.
    If u have any documets regarding adding one more fied to existing search help plz send me.
    Thanks & Regards,
    farook.
    Edited by: farook shaik on Aug 18, 2009 8:58 AM

    Hi,
       You can do that using search help exits you would find several threads already posted to the forum for this like below:
    Link[Search Help Exits|Search Help Exit;
    Regards,
    Himanshu

  • Help with html code - inserting video into Muse

    I am seeking help writing the code to insert a video into Muse. I uploaded video into my Business Catalyst hosting. I need it to autoplay, loop and not show any controls or frames.
    When I host video on Vimeo or YouTube, I see markings on the video that is why I am trying to just host in the same place that the files are stored for my website. If there is a way to host on youtube with out any markings showing up on the video I would be open to that too.
    I don't want to see any play button or time bar.
    Thanks in advance!!

    Hello,
    Just as an FYI - we also have an HTML5 video tool over at MuseThemes.com that achieves this, but works on mobile devices as well. The link above looks like it uses Flash, which isn't common anymore since the release of HTML5 based video.
    Simply drag the widget out onto your canvas, and link up your videos / set options like loop, controls visible, etc. It's quite a flexible widget, and there's a complete training video included so you don't get stuck
    Check out the widget here
    Just wanted to provide another alternative that could be helpful. Cheers!
    Steve Harris
    MuseThemes.com

  • Need help in transcation code ime0

    I need help in transaction code ime0. I mean to say what is this TCode doing? What different Drill-down program means? Where I can use this report?
    Regards,
    Subhasish

    Hi
    Please check the link for help
    <a href="http://help.sap.com/saphelp_47x200/helpdata/EN/5c/8db33f555411d189660000e829fbbd/frameset.htm">CA - Drilldown Reporting</a>
    Hope it helps
    Anirban

  • Search help and Match code oject

    How to create the search help in version 5.0 and 6.0 ? what is elementary search help,collective search help? what is the use of these search helps? where we use elementary and collective searsc helps? what is the difference between searc help and match code object? how to use in reports?where we use search help and F4IF_INT_TABLE_VALUE_REQUEST function module? what is the diffference between them?

    Hi Rk,
    1) Elementary search helps describe a search path. The elementary search help must define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help).
    2) Collective search helps combine several elementary search helps. A collective search help thus can offer several alternative search paths.
    3)An elementary search help defines the standard flow of an input help.
    4) A collective search help combines several elementary search helps. The user can thus choose one of several alternative search paths with a collective search help.
    5)A collective search help comprises several elementary search helps. It combines all the search paths that are meaningful for a field.
    6)Both elementary search helps and other search helps can be included in a collective search help. If other collective search helps are contained in a collective search help, they are expanded to the level of the elementary search helps when the input help is called.
    CREATION:
    Go to SE11 Tcode
    select search help
    give the 'z' search help name and create
    select the selection method ur table name eg : 'mara'
    dialog module 'display value immediately'.
    add the field whatever u want and lpos = 1 and spos = 1 and check import and export parameter.
    where left position when displaying and spos = search position
    and then save and activate ..
    See the links:
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee38446011d189700000e8322d00/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee45446011d189700000e8322d00/content.htm
    pls go through this for search help creation
    http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
    Search Help Exits:
    Re: dynamic values for search help
    Re: Dynamic search  help
    Thanks,
    Reward If Helpful.

  • Can you help with the code to publish Flash to my own domain.

    Thank you for your help, I publish the my site to my own domain, I do not use .Mac, I tested your code and ity works well on .Mac, can you help with the code to publish to my own domain.
    Thank you again

    You appear to have just collected a variety of code snippets and thrown them together, including a section of AS2 code ( gage.onRelease = function() {... )
    The suggestion I offered yesterday still stands.  You should find a tutorial regarding AS3 and the atan2 function.  Beyond that, what you show suggests this is a school assignment.  You should seek help from your fellow students and instructor if that is the case.

  • My macbook pro intel core duo 2 keeps restarting intermittenly. Help with error code.

    I have run a Hardware Test, and it gives the follwing error code. Can anyone tell me what this is? I recently had my logic board replaced within the last 3 months, so it shouldn't be a problem there.
    Thank you very much for any and all help.
    Error code:
    4SNS/I/40000000:TGOH-128.00

    Online references possible memory issue? Sensors?
    https://discussions.apple.com/thread/3140607?start=0&tstart=0
    Keep taking it back and they keep switching parts until the problem is gone.

  • Getting Exception: @Scratchpad/1:1 exception while running simple javascript code in mozilla scrachpad

    getting Exception: "@Scratchpad/1:1 exception" while running simple javascript code in mozilla scrachpad

    Does this also happen if you run the code in the Web Console (Firefox/Tools > Web Developer)?
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • I need help with this code error "unreachable statement"

    the error_
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errors
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    public class Tools//tool class
    private int numberOfToolItems;
    private ToolItems[] toolArray = new ToolItems[10];
    public Tools()//array of tool
    numberOfToolItems = 0;
    for(int i = 0; i < toolArray.length; i++)//for loop to create the array tools
    toolArray[i] = new ToolItems();
    }//end for loop
    }//end of array of tools
    public int search(int id)//search mehtod
    int index = 0;
    while (index < numberOfToolItems)//while and if loop search
    if(toolArray[index].getID() == id)
    return index;
    else
    index ++;
    }//en while and if loop
    return -1;
    }//end search method
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0;
    int index;
    index = search(id); <-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    }//end delete method
    public void display()//display method
    for(int i = 0; i < numberOfToolItems; i++)
    //toolArray.display(g,y,x);
    }//end display method
    public String getRecord(int i)//get record method
    // return toolArray[i].getName()+ "ID: "+toolArray[i].getID()
    }//end getrecod
    }//end class
    Edited by: ladsoftware on Oct 9, 2009 6:08 AM
    Edited by: ladsoftware on Oct 9, 2009 6:09 AM
    Edited by: ladsoftware on Oct 9, 2009 6:10 AM
    Edited by: ladsoftware on Oct 9, 2009 6:11 AM

    ladsoftware wrote:
    Subject: Re: I need help with this code error "unreachable statement"
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errorsThe compiler is telling you exactly what the problems are:
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0; // <<== HERE you return, so everyting in the if block after this is unreachable
    int index;
    index = search(id);  //< -----------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    // <<== HERE where is the return statement?
    }//end delete method
    public String getRecord(int i)//get record method
    // return toolArray.getName()+ "ID: "+toolArray[i].getID() <<== HERE you commented out the return statement
    }//end getrecod
    }//end class

  • Plz can someone show me simple thread code work

    Plz can someone show me simple thread code work with main function, without any applet...thread including start(),run(), and stop(), am I right or not ??
    thx

    http://java.sun.com/docs/books/tutorial/essential/threads/index.html

  • Help with Exit Code: 7

    Install Flex 4
    Exit Code: 7
    -------------------------------------- Summary --------------------------------------
    - 0 fatal error(s), 3 error(s), 1 warning(s)
    WARNING: Memory requirements not met for {74EF259F-1DC6-4DEE-866B-0707173D7654}
    ERROR: Custom Action for payload {74EF259F-1DC6-4DEE-866B-0707173D7654} Adobe Flash Builder returned error. Failing this payload.
    ERROR: The following payload errors were found during install:
    ERROR:  - Adobe Flash Builder: Install failed
    My Pc
    Pentium D CPU 2.80GHz, 2.80GHz
    992 MB in RAM
    HDD: 38.0GB, Used: 23.3GB, Free: 14.7GB
    Sistem
    Microsoft Windows XP Pro.
    Ver. 2002
    Service Pack 3
    Help to install tehe Flex Build 4, plase.

    Hi,
    I had a similar problem (see error details below) installing on Windows 7 Professional using a domain account which is in the local admin group. I think my problem was due to an @ character in one of the following environment variables:
    APPDATA=C:\Users\my_username@my_company.com\AppData\Roaming
    HOMEPATH=\Users\my_username@my_company.com
    LOCALAPPDATA=C:\Users\my_username@my_company.com\AppData\Local
    USERPROFILE=C:\Users\my_username@my_company.com
    I solved the problem by creating a local account with a plalin alphabetical username, adding it to the local administrator group and re-running the installer under that account by right clicking and selecting "Run as Administrator".
    I got this idea from the following blog posts:
    http://www.niallodoherty.com/post.cfm/adobe-flash-builder-4-installation-error-exit-code-7
    http://www.joebillman.com/blog/2010/04/flash-builder-4-install-error/
    Hope that helps,
    Carl
    Exit Code: 7
    -------------------------------------- Summary --------------------------------------
    - 0 fatal error(s), 4 error(s), 0 warning(s)
    ERROR: Custom Action for payload {74EF259F-1DC6-4DEE-866B-0707173D7654} Adobe Flash Builder returned error. Failing this payload.
    ERROR: The following payload errors were found during install:
    ERROR:  - Adobe Flash Builder: Install failed
    ERROR:  - Adobe Flash Player 10 ActiveX: Install failed

Maybe you are looking for

  • Email thru Report - Changing the Subject

    Hi, I am using Reports6.0 in windows. while sending Report(PDF) output to relevant email-id. System automatically set the default message to "Report sent from Report Builder ...' How can I change this default message to user message. Pls. Help me.

  • Preview arrows not showing in web search

    I have noticed today that when I am searching the web the preview arrows are missing so unable to preview a page quickly before deciding to open. Can anyone help, has anything changed with Safari?  (Normally use Google) Any help appreciated!

  • Emac Monitor Gone Very Blurry?

    Hi, The EMAC last night was fine when I got home from work, I read an email, then all of a sudden the display went blurry - like the effect on some slideshows, except it never recovered. Changing the resolution to 640 x 480 helps slightly but it's st

  • Since Lion I can't attach file contents to mail in Mail.

    Whe I go to attach something to an email in Mail, i click on the folder that holds the document I want to attach, and it attaches the whole folder. It used to go into the contents and allow me to select from there. If it were a sub folder it would op

  • Planning Actual Monthly for activity input

    Hi All, can we make planning or actual by monthly using activity input? Should i use tcode CJ40 or CJR2 ? Please guide me in detail . Cheers, Nies