I am having trouble making my program output correctly on my 2nd while loop

I am just having issues with this program big time. I have been working on it for 6 days and still no cigar. What's going on is I am trying to do the juggler sequence and I have the calculations correct, the issue I am now having is every time I do the calculations the same number keeps printing and I am having trouble making it output all the numbers on 1 line. If anyone can help that'll be great. Thank you!

This is how the output SHOULD look like but I can't get it.
http://imgur.com/MX6CKhD


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>

using std::cout;
using std::cin;
using std::endl;
using std::setw;


/*
 * 
 */
int main(){
    long user_int = 0;
    long end_int = 0;
    long counter = 0;
    long int_per_line = 0;
    long user_ans = 0;
    
    cout << "Enter two separate numbers, check from low to high " << endl;
    cout << "Input 1st integer: ";
    cin >> user_int;
    cout << "Input 2nd integer: ";
    cin >> end_int;
    
    counter = user_int - 1;
    
    
    long end_start = end_int - user_int;
    
    
    cout << "Do you want to see each sequence (1=yes/0=no):  ";
    cin >> user_ans;
    
    
    while(user_ans == 1){
        for(long i = 0; i <= end_start; i++){
        
            if(user_int % 2 == 0){
                user_int = pow(user_int, 0.5);
                user_int = floor(user_int);
            }
            
            else{
                user_int = pow(user_int, 1.5);
                user_int = floor(user_int);
            }
      
        
            while ( i <= end_start){
                counter = counter + 1;
                if(user_int != 1){
                    cout << "Juggler sequence of " << counter << " is:" << user_int << endl;
                    i = i + 1;
                }
            }
            
        }
        
        
    cout << "Do you want to see each sequence (1=yes/0=no):  ";
    cin >> user_ans;
    

    
    }
    
    
        return 0;
}
closed account (48T7M4Gy)
Don't post twice for same problem
Last edited on
Excuse you but there are in 2 different topics. I don't know if this is a general C++ problem or beginners
closed account (48T7M4Gy)
It's the same problem
Again I will say since you did not understand my English, they are in 2 different topics. I don't know if this is a general C++ problem or beginners C++ problem
closed account (48T7M4Gy)
Yawn
Or, as is more likely, kemort did understand your English, but you are ignoring him because you think that you know better. Posting the same problem in two different parts of the same website is considered bad practice as it clutters the website. It doesn't really matter which you classify it as, likelihood is most people who want to help check both. Just choose one and delete the other one if it will let you. Personally, I'd have gone with beginners.
Topic archived. No new replies allowed.