The basics of programming in c++ for beginners

Tasks: arithmetic operations in C ++

If you have already read the articleArithmetic operations in C ++ you can begin to practice.

1. Common task:  Given the four-digit number (for example 5678), display the numbers in reverse order of which is the number of member. That is, we should see on the screen 8765. Tip: to take from among the individual numbers, should be applied to the modulo 10.

2. The site of almost any commercial bank, you can find the so-called Deposit calculator, which allows people to, not wishing to go into the formula for calculating interest rates, to know how much they will receive. To do this, they just fill in certain fields, press the button and see the result. This is a simple program, which has already been able to write each one of you. So, a task: The user enters the amount of the deposit and the number of months of keeping money in the bank. It is necessary to calculate and show the screen profit from the deposit in a month,  for the entire term of the deposit, and the total amount payable at the end of the period.  Currency let it be – U.S. dollar. Interest rate – 5% APR.  The formula for calculating percent per month–                      SumDeposit * (interest rate / 100)  / daysperyear * dayspermonths.

Perhaps you have any questions about the solution of tasks – ask them in the comments!

151 thoughts on “Tasks: arithmetic operations in C ++

  1. #include ;
    using namespace std;

    int main()
    {
    setlocale(LC_ALL, “rus”);
    cout << "\a\a\a\a\n";
    float fsummadepozita(0);
    int imesaci(0);
    float fprocenti(9.8);
    int idni(365);
    you hate me(30);
    float fprocentivmesac(0);
    float fitogovaisumma(0);
    int iitog(0);
    cout << "Процентная ставка по вкладу = " << fprocenti << endl;
    cout << "Внимание прибыль с депозита в месяц расчитывается с учетом 365 days a year and 30 дней в месяце \n";
    cout <> fsumdeposit;
    cout <> to do so;

    fprocentivmesac = fsummadepozita * (fprocenti / 100) / idni*idnimecisa;
    fitogovaisumma = fsummadedeposit * (fprocenti / 100);
    iitog = fsumdepozita + fitogovaisumma;
    cout << "Прибыль от вклада в месяц составит \-" << fprocentivmesac << "\t рублей" << endl;
    cout << "Общая прибыль по итогам хранения составит \-" << fitogovaisumma << "\t рублей" << endl;
    cout << "Итоговая сумма после хранения \-" << iitog << "\t рублей" << endl;
    return 0;
    }

    solved the second problem… I decided to bother with it some more.)

  2. why do all the percentages come out = 0?

  3. #include
    int main()
    {
    int i = 5678;
    int a = i % 567;
    int b = ((I % 56)-8)/10;
    int c = ((I % 5000)-78)/100;
    int d = (i-678)/1000;
    int igf = (a * 1000) + (b * 100) + (c * 10) + d;
    std::cout << "igf=" << "/t" << igf << endl;
    return o;
    }
    Rational?

  4. 1 the task is solved much easier:

    #include
    using namespace std;

    void main()
    {
    setlocale(LC_ALL, “rus”);
    int a=0;
    cout<>a;
    cout<<"Ваше число: "<<a<<a/10<<a/100<<a/1000;
    }

  5. Help! Why is monthly interest not calculated?? With this program code
    #include
    using namespace std;

    int main()
    {
    setlocale(LC_ALL, “rus”);
    long summa_depozita;
    cout <> summa_deposita;
    int kolichestvo_mesyacev;
    cout <> kolichestvo_mesyacev;
    cout << endl;
    const int stavka = 5;
    cout << "Процентная ставка – " << item << "% годовых" << endl;
    const int day_v_godu = 365;
    cout << "Дней в году – " << day_v_godu <<" дней"<< endl;
    int day_v_monthyace;
    cout <> dney_v_mesyace;
    cout << "Будет начисленно – " << deposit_summa*(item / 100) / (dney_v_godu*dney_v_mesyace) << " % per month" << endl;
    return 0;
    }

    1. #include
      using namespace std;

      int main()
      {
      setlocale(LC_ALL, “rus”);
      long summa_depozita;
      cout <> summa_deposita;
      int kolichestvo_mesyacev;
      cout <> kolichestvo_mesyacev;
      cout << endl;
      const int stavka = 5;
      cout << "Процентная ставка – " << item << "% годовых" << endl;
      const int day_v_godu = 365;
      cout << "Дней в году – " << day_v_godu <<" дней"<< endl;
      int day_v_monthyace;
      cout <> dney_v_mesyace;
      cout << "Будет начисленно – " << deposit_summa*(item / 100) / (dney_v_godu*dney_v_mesyace) << " % per month" << endl;
      return 0;
      }

  6. I did this first:

Leave a Reply

Your email address will not be published. Required fields are marked *