0 / 0 / 0
Регистрация: 04.09.2018
Сообщений: 140
1

разработка программы для деления в столбик

20.10.2019, 01:48. Показов 755. Ответов 1
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
здравствуйте. разрабатываю программу для деления в столбик. среда visual studio 2013. возникла проблема при компиляции программы. компилятор сообщает что переменная count двусмысленна 1 IntelliSense: "count" is ambiguous c:\Users\worker\Documents\Visual Studio 2013\Projects\Project1\Project1\Source.cpp 44 10 Project1 2 IntelliSense: "count" is ambiguous c:\Users\worker\Documents\Visual Studio 2013\Projects\Project1\Project1\Source.cpp 49 15 Project1
3 IntelliSense: "count" is ambiguous c:\Users\worker\Documents\Visual Studio 2013\Projects\Project1\Project1\Source.cpp 97 3 Project1
4 IntelliSense: "count" is ambiguous c:\Users\worker\Documents\Visual Studio 2013\Projects\Project1\Project1\Source.cpp 97 11 Project1
не понимаю почему так происходит ведь я объявил эту переменную в программе только один раз. что надо изменить в коде программы чтобы не было ошибки?
C++
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#include<iostream>
using namespace std;
double pow1(double a, int b);
double extractdigit(double * a, int position, int shift);
void greaterpush(double * a, double * b, int del);
void digittoarray(double a, double * b);
int positsija = 0;
int smeshenije = 0;
int extractpositsija = 0;
int extractsmeshenije = 0;
int & x = smeshenije;
int count = 0;
int count2 = 0;
int main(){
    cout << "enter a digit " << endl;
    double digit;
    cin >> digit;
    int var;
    cout << "vvedi delitel " << endl;
    cin >> var;
    double znachenije = digit;
    int i = 0;
    while (digit >= pow1(10, i))
        i = i + 1;
    double *ptr = new double[i];
    double *ptr2 = new double[i];
    double *ptr3 = new double[i];
    i = i - 1;
    int k;
    int m;
    k = i;
    int l = 0;
    while (l <= k){
        ptr[l] = (int)digit / (int)pow1(10, i);
        digit = digit - ptr[l] * pow1(10, i);
        l = l + 1;
        i = i - 1;
    }
    l = 0;
    int v = 1;
    int x, y;
    y = 0;
    
    int z = count - 1;
    int u;
    int w = 0;
    while (w<=count2){
        greaterpush(ptr, ptr2, var);
        while (v <= count){
            
            x = ptr2[l]*pow(10, z);
            y = y + x;
            z = z - 1;
            v = v + 1;
            l = l + 1;
        }
        l = 0;
        x = y / var;
        ptr3[l] = x;
        k = x*var;
        u = x - k;
        digittoarray(u, ptr2);
    }
    while (1){
        ;
    }
}
double pow1(double a, int b){
    double c = 1;
    double d;
    int i = 1;
    if (b == 0)
        d = 1;
    else if (b != 0){
        while (i <= b){
            c = c*a;
            i = i + 1;
        }
        d = c;
    }
    return d;
}
double extractdigit(double * a, int position, int shift){
    int pos = position;
    int smes = shift;
    double * ptr = a;
    double b, c;
    c = 0;
    int k = position + shift;
    int m = k - pos;
    int l = k - 1;
    while (pos <= k){
        b = ptr[pos] * pow1(10, m);
        c = c + b;
        m = m - 1;
        pos = pos + 1;
        count = count + 1;
    }
    return c;
}
void greaterpush(double * a, double * b, int del){
    double * pointer1 = a;
    double * pointer2 = b;
    int delitel = del;
    double c;
    int k = 0;
    int l = k + smeshenije;
    while (1){
        c = extractdigit(pointer1, positsija, smeshenije);
        if (c >= delitel){
            digittoarray(c, pointer2);
            positsija = positsija + smeshenije + 1;
            smeshenije = 0;
            break;
        }
        else if (c<delitel)
            smeshenije = smeshenije + 1;
    }
    x = smeshenije;
    count2 = smeshenije;
}
void digittoarray(double a, double * b){
    double chislo;
    chislo = a;
    double * pointer;
    pointer = b;
    int i = 0;
    double c, d;
    int k = 0;
    while (chislo >= pow1(10, i))
        i = i + 1;
    i = i - 1;
    while (i >= 0){
        c = (int)chislo / (int)pow1(10, i);
        while (pointer[k] != 0)
            k = k + 1;
        pointer[k] = c;
        chislo = chislo - c*pow1(10, i);
        i = i - 1;
        k = k + 1;
    }
}
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
20.10.2019, 01:48
Ответы с готовыми решениями:

программа для деления в столбик
Здравствуйте. Не могу разобраться с проблемой в программе для деления в столбик. программа не...

Реализация целочисленного деления в столбик
Доброго времени суток, на повестке дня пришла задача реализовать целочисленное деление в столбик на...

Разработка программы для решения интеграла
Помогите разобраться как это сделать

Разработка программы для решения интеграла
Заданна функция. Необходимо написать код вычисляющий определенный интеграл.

1
║XLR8║
1212 / 909 / 270
Регистрация: 25.07.2009
Сообщений: 4,361
Записей в блоге: 5
20.10.2019, 03:08 2
Tifan,
C++
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#include <iostream>
#include <cmath>
 
using namespace std;
 
double pow1(double a, int b);
double extractdigit(double *a, int position, int shift);
void greaterpush(double *a, double *b, int del);
void digittoarray(double a, double *b);
 
int positsija = 0;
int smeshenije = 0;
int extractpositsija = 0;
int extractsmeshenije = 0;
int &x = smeshenije;
int count = 0;
int count2 = 0;
 
int main()
{
    cout << "enter a digit " << endl;
    double digit;
    cin >> digit;
    int var;
    cout << "vvedi delitel " << endl;
    cin >> var;
    double znachenije = digit;
    int i = 0;
    while (digit >= pow1(10, i))
        i = i + 1;
    double *ptr = new double[i];
    double *ptr2 = new double[i];
    double *ptr3 = new double[i];
    i = i - 1;
    int k;
    int m;
    k = i;
    int l = 0;
    while (l <= k)
    {
        ptr[l] = (int)digit / (int)pow1(10, i);
        digit = digit - ptr[l] * pow1(10, i);
        l = l + 1;
        i = i - 1;
    }
    l = 0;
    int v = 1;
    int x, y;
    y = 0;
 
    int z = count - 1;
    int u;
    int w = 0;
    while (w <= count2)
    {
        greaterpush(ptr, ptr2, var);
        while (v <= count)
        {
 
            x = ptr2[l] * std::pow(10, z);
            y = y + x;
            z = z - 1;
            v = v + 1;
            l = l + 1;
        }
        l = 0;
        x = y / var;
        ptr3[l] = x;
        k = x * var;
        u = x - k;
        digittoarray(u, ptr2);
    }
    while (1)
    {
        ;
    }
}
double pow1(double a, int b)
{
    double c = 1;
    double d;
    int i = 1;
    if (b == 0)
        d = 1;
    else if (b != 0)
    {
        while (i <= b)
        {
            c = c * a;
            i = i + 1;
        }
        d = c;
    }
    return d;
}
double extractdigit(double *a, int position, int shift)
{
    int pos = position;
    int smes = shift;
    double *ptr = a;
    double b, c;
    c = 0;
    int k = position + shift;
    int m = k - pos;
    int l = k - 1;
    while (pos <= k)
    {
        b = ptr[pos] * pow1(10, m);
        c = c + b;
        m = m - 1;
        pos = pos + 1;
        count = count + 1;
    }
    return c;
}
void greaterpush(double *a, double *b, int del)
{
    double *pointer1 = a;
    double *pointer2 = b;
    int delitel = del;
    double c;
    int k = 0;
    int l = k + smeshenije;
    while (1)
    {
        c = extractdigit(pointer1, positsija, smeshenije);
        if (c >= delitel)
        {
            digittoarray(c, pointer2);
            positsija = positsija + smeshenije + 1;
            smeshenije = 0;
            break;
        }
        else if (c < delitel)
            smeshenije = smeshenije + 1;
    }
    x = smeshenije;
    count2 = smeshenije;
}
void digittoarray(double a, double *b)
{
    double chislo;
    chislo = a;
    double *pointer;
    pointer = b;
    int i = 0;
    double c, d;
    int k = 0;
    while (chislo >= pow1(10, i))
        i = i + 1;
    i = i - 1;
    while (i >= 0)
    {
        c = (int)chislo / (int)pow1(10, i);
        while (pointer[k] != 0)
            k = k + 1;
        pointer[k] = c;
        chislo = chislo - c * pow1(10, i);
        i = i - 1;
        k = k + 1;
    }
}
cmath и std:: перед pow пропущено.
0
20.10.2019, 03:08
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
20.10.2019, 03:08
Помогаю со студенческими работами здесь

Разработка программы для расчета футбольных матчей
Надо разработать программу для расчета футбольных матчей Что должно быть в программе: Выбор...

Разработка программы для работы со структурами и файлами данных
не получается сделать корректный вывод запросов. например: при запросе на номер один, должно...

Разработка программы для ведения картотеки сотрудников предприятия
Задание: Разработка программы для ведения картотеки сотрудников предприятия Необходимо...

Разработка программы для учёта показаний водомера через интернет
Пожалуйста помогите!!!! Необязательно через интернет!! Любой вариант на любом из следующих языках:...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru