User Profile

Collapse

Profile Sidebar

Collapse
Andrew V
Andrew V
Last Activity: Jun 9 '12, 02:34 PM
Joined: May 29 '12
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Andrew V
    replied to Explanation
    in C
    well,i have to do a program that will do A to the power B.
    B can be 1,0,positive or negative.I have done this program.And that line
    Code:
    y=-y
    i have writed it because i had no ideas how i can do it to work with negative powers.And i i erease that line the program it will not work for negative power and if i keep it it works.I want to know what that line means and why i can't do it without it.
    See more | Go to post

    Leave a comment:


  • Andrew V
    replied to Explanation
    in C
    Yes but how can i do it without that?...
    See more | Go to post

    Leave a comment:


  • Andrew V
    replied to Explanation
    in C
    uhm...why not? if that line is there the program it will not work for negative power.
    See more | Go to post

    Leave a comment:


  • Andrew V
    replied to Explanation
    in C
    When i compiled it it gives the same result,and i think it's the same.
    See more | Go to post

    Leave a comment:


  • Andrew V
    started a topic Explanation
    in C

    Explanation

    Can someone explain me what the
    Code:
    y=-y;
    stands for in
    Code:
    #include<iostream.h>
    using namespace std;
    int main(){
    int x, y;
    float product=1 ;
    cout << "Enter a base number: ";
    cin >> x;
    cout << "Enter an integer exponent: ";
    cin >> y;
    int i = 1;
    if (y<0)
    { y=-y;//HERE I AM
    while (y>=i)
    {
    product
    ...
    See more | Go to post

  • Andrew V
    replied to Output wrong..
    in C
    Code:
       while(count<=-1*n){
    or
    Code:
       while(n<0){
    and then what?
    how do i save a number..
    See more | Go to post

    Leave a comment:


  • Andrew V
    replied to Output wrong..
    in C
    Ok so i put
    Code:
     while(n<0){
    and then i put
    Code:
     y = y*x;
          count--;
          cout<<y;
    but the output doesn't stop.I am working for like 6 hours at this project.Can u give me a hint?
    See more | Go to post

    Leave a comment:


  • Andrew V
    replied to Output wrong..
    in C
    Ok,i solved with positive and 0 powers.But now i am trying to do with negative power.I want it to show :
    x=2
    n=-1
    y=0.5
    i changed the code
    Code:
    while ( count <= n);
    with
    Code:
    while ( count >= n);
    but nothing happens.And when i am trying to put it with if(){} it gives the same number with the x(the base) with every number i enter
    See more | Go to post

    Leave a comment:


  • Andrew V
    replied to Output wrong..
    in C
    Got it.My bad i readed while and while but it was do-while and while sorry
    See more | Go to post

    Leave a comment:


  • Andrew V
    started a topic Output wrong..
    in C

    Output wrong..

    This is my code and i dont know why when i enter let's say x=3 and n=0 it gives 3.


    Code:
    #include <cstdlib>
    #include <iostream>
    
    using namespace std;
    
    int main()                                                      
       {            
             printf("==========©©Andrei78©©==========");
             printf("=======©All Rights Reserved©====");
    ...
    See more | Go to post

  • Andrew V
    replied to A to the power B question
    in C
    i have done something but idk why it gives with error...
    Code:
    #include<iostream>
    using namespace std;
    int main()
    {
        float a, b, c, d;
        cout << "enter the base";
        cin >> a;
        
        cout << "enter the power";
        cin >> b;
        a=d;
        do{
            d*a;
            }while(d<=b);
       cout<<a<<"the
    ...
    See more | Go to post

    Leave a comment:


  • Andrew V
    started a topic A to the power B question
    in C

    A to the power B question

    Hello guys,i need a program which can calculate A to the power B. Like,i input 2 and 3 and it gives 8.And i need it done with loops.Thank you for helping,
    See more | Go to post

  • Andrew V
    replied to Arrays Question
    in C
    that's it i have done it it's finished and done!! hurray!
    Code:
    #include<iostream>
    using namespace std;
    int main()
    {
         int input;
         int highest = 0;
         int lowest = 0;
         
        cout<< "Enter A  Number (0 to stop the loop): \n";
         cin >> input;
         highest = input;
         lowest = input;
         while(input!=0)
         {
            cout
    ...
    See more | Go to post

    Leave a comment:


  • Andrew V
    replied to Arrays Question
    in C
    Ok,so now i need the same program but with loop not arrays,not with anything,only loop.can anyone help me please.
    oh and btw i have done that with arrays look
    Code:
    #include <iostream>
    using namespace std;
    int main ()
    {
        int a[5],y,max;
        cout<<"Enter 5 numbers "<<endl;
        for (y=0;y<5;y++)
        {
            cin>>a[y];
            if (y==0) max=a[y];
    ...
    See more | Go to post

    Leave a comment:


  • Andrew V
    replied to Arrays Question
    in C
    I know,i fixed it and now i understand the thing with [] they are arrays. What i am tryin to do is a program that it will say the maximum number of a given list.if you can help me i would be very thankfully.
    See more | Go to post

    Leave a comment:


  • Andrew V
    started a topic Arrays Question
    in C

    Arrays Question

    can someone explain to me what is the meaning of the right braket here
    Code:
    #include <iostream>
    using namespace std;
    int main ()
    {
        int a[5],y,max;
        
        for (i=0;y<5;i++)
        {
            cin>>a[i];
            if (y==0) max=a[y];
            if (a[y]>max) max=a[];
        }
        cout<<"max numb is:"<<max;
        system("pause");
    ...
    See more | Go to post
    Last edited by Rabbit; May 29 '12, 03:51 PM. Reason: Please use code tags when posting code.
No activity results to display
Show More
Working...