Number generation

Hi All,

I need c++ code to get the numbers. Could somebody please help me on this

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
#include <iostream>
using namespace std;

int Rownumgen(int input,int streamno,int nostream)
{
/*This programme should return numbers in sequence irrespective of stream number. 

here input means gives the record number such as first record it gives 1 second record 2........etc n.
steamno means stream number, if we have total 3 streams and this is first stream this would be 1.
nostream means total no. of streams eg: 3

Eg: we have total 10 rows.
stream 1 has 9 and stream 2 has 1 and stream 3 0 rows.

Output would be 
1
2
3
4
5
6
7
8
9
10

*/

int Number=((nostream * (input -1)) + streamno);
Return Number;


}

But this code gives as below 

1
2
4
7
10
13
16
19
22
25


This code might be wrong completely, but i tried with the logig "Number=((nostream * (input -1)) + streamno)" I am not much aware of c++ coding(Any coding). Here the records/rows are passed one by one its a parallel process

so thought posting here to get the code if some one can help.
Last edited on
Topic archived. No new replies allowed.