Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8164131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:14:52+00:00 2026-06-06T19:14:52+00:00

My console app looks like that. #include stdafx.h #include <iostream> #include <cmath> using namespace

  • 0

My console app looks like that.

#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    int a, b;
    cin>>a>>b;
    cout<<"% "<<a%b<<endl<<"fmod "<<fmod(a,b)<<endl;
    system("pause");
    return 0;
}

I’m newbie to C++ and I got 2 questions:

  1. Writing this application on VS. Why do I need to include “stdafx.h”? Is there any requirement? What is this?
  2. Is there any difference between fmod and % ? Getting exactly same results for them:

enter image description here

Thx in advance..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:14:54+00:00Added an answer on June 6, 2026 at 7:14 pm

    Writing this application on VS. Why do I need to include “stdafx.h”? Is there any requirement? What is this?

    Because the default project setting says you need precompiled header (See this).

    You can disable this manually. Select Not Using Precompiled Headers as shown in the image below:

    enter image description here


    Is there any difference between fmod and % ? Getting exactly same results for them:

    Yes. % cannot operate on floating-pointer numbers, while fmod can. f in fmod indicates floating-point.

    Try this:

    float a, b;
    std::cin>>a>>b;
    std::cout << (a%b) << std::endl; //it will give compilation error.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm c++ newbie. My first app looks like that. #include stdafx.h #include <iostream> using
I've got a console app that loads up a datatable; I'd like to export
I'm building an app using Brunch and Backbone.js that is to include nested menus.
I have a config Section in my app.config that looks like this <configSections> <section
I have a console app that performs a lengthy process. I am printing out
For an C# console app like this is it better to use xcopy or
I have console app A that references another console app B. B app has
I have a console app that's geared to be automatically ran as a Scheduled
In a console app, an ascii spinner can be used, like the GUI wait
I have a console app built on .NET 4 that uses the HttpClient library

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.