Прошу помочь с С++

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by ASK.FM, 6 Nov 2013.

  1. ASK.FM

    ASK.FM New Member

    Joined:
    10 Aug 2012
    Messages:
    12
    Likes Received:
    1
    Reputations:
    0
    Здравствуйте, уважаемые античатовцы. Прошу у вас помощи с программой:

    [​IMG]

    // 515.cpp: определяет точку входа для консольного приложения.
    //

    #include "stdafx.h"


    int _tmain(int argc, _TCHAR* argv[])
    {
    return 0;
    }

    #include <iostream>
    #include <math.h>
    #include <conio.h>
    using namespace std;
    int main ()
    {
    int s,n,i,x=0;
    cout<<"x"<<x;
    cin >> x;
    cout<<"n"<<n;
    cin >> n;
    for(i=2;i<=n;i++)
    s=s+(1+pow(x,2*i));
    cout << s;
    getch();
    return 0;
    }
     
  2. Spot

    Spot Elder - Старейшина

    Joined:
    1 Mar 2007
    Messages:
    462
    Likes Received:
    38
    Reputations:
    1
    Code:
    [COLOR=DarkOrange]
    #include <stdlib.h>
    #include <iostream> 
    #include <math.h>
    #include <conio.h>
    using namespace std;
    int main ()
    {
    int s = 0,n = 0,i = 0, x=0;
    cout<<"x"<<x;
    cin >> x;
    cout<<"n"<<n;
    cin >> n;
    
    s = 2*(1 + _Pow_int(x,2));
    if(n > 1)
    {
    for(int i = 2; i <= n; i++)
    {
    	s *= (1 +_Pow_int(x,2*i));
    }
    }
    
    cout << s;
    getchar();
    _getch();
    return 0;
    }[/COLOR]
    
     
Loading...