- Újabb részletek a Galxy S26 Ultra privát képernyőmódjára vonatkozóan
- iPhone topik
- 10 hasznos trükk Xiaomi / Redmi / Poco telefonokhoz
- Azonnali navigációs kérdések órája
- Huawei Pura 80 Pro – a másik zsebbe
- Motorola Edge 50 Neo - az egyensúly gyengesége
- Garmin topik
- Privát Samsung funkciót tehet az Apple publikussá
- Különleges élményre invitál az Apple
- Samsung Galaxy S23 és S23+ - ami belül van, az számít igazán
Új hozzászólás Aktív témák
-
Dirty_Pio
csendes tag
Sziasztok, volna egy kis problemam egy programmal... eleg sok errort kidob, de en nem ertem mia baja. Az errorok a figgvenyekre vonatkoznak nagyreszben, azzal a szoveggel, hogy pl. az elso fuggvenybe x has a forward declaration. A feladat szovege
rite a program to add two large integer numbers of length up to 80 digits (no predefined type offers this range/precision !). One approach is to treat each number as an array of digits. The two integers (arrays) are added element by element, carrying from one element to the next when necessary. Each number is read digit by digit (a loop of getchar() until end of line is encountered) and stored in an array of digits.//program 5.6 (lab)
#define MAX 81
#include <stdio.h>
#include <stdlib.h>
int reading(int x[];int max)
{
int i,c;
while (c=getchar()!=EOF)
{
x[i]=c-'0';
i++;
}
i--;
return i;
}
int add(int a; int b; int r)
{
int s;
s=a+b+r;
return s;
}
int reminder(int a; int b; int r)
{
int s;
s=(a+b+r)/10;
return s;
}
int main(void)
{
int i,j,k,r;
int x[MAX],y[MAX],z[MAX];
i=reading(x,MAX);
j=reading(y,MAX);
r=0;
for (k=0; (k<=i) && (k<=j); k++)
{
z[k]=add(x[k],y[k],r);
r=reminder (x[k],y[k],r);
}
if (i<j) for (k; k<=j; k++)
{
z[k]=add(0,y[k],r);
r=reminder(0,y[k],r);
};
else
for (k; k<=j; k++)
{
z[k]=add(0,x[k],r);
r=reminder (0,x[k],r);
};
z[k++]=r;
for (i=0;i<(k+1);i++)
printf("%i \n",z[i]);
system("pause");
return(0);
}
na asszem megvan a baj... a figgvenybe ; hasznaltam , helyett grrr..
Új hozzászólás Aktív témák
● olvasd el a téma összefoglalót!
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- Beleremegett Hollywood Brad Pitt és Tom Cruise AI harcába
- Háztartási gépek
- Hardcore café
- AMD Ryzen 9 / 7 / 5 7***(X) "Zen 4" (AM5)
- Xbox Series X|S
- Újabb részletek a Galxy S26 Ultra privát képernyőmódjára vonatkozóan
- Azonnali fáradt gőzös kérdések órája
- Képregény topik
- Tarr Kft. kábeltv, internet, telefon
- iPhone topik
- További aktív témák...
- szinteÚJ 2030 Gar! Dell Pro Max 14 Ryzen AI 9 HX PRO 370 32GB LPDDR5X 512GB NVMe SSD
- Dell Pro Plus 14 Core Ultra 5 238V 32GB 1000GB FHD+ TouchScreen ProSupport Plus gar: 2028.10.07
- Apple iPhone 13 128 GB 88%
- Garmin Forerunner 965 - 1 hónap garanciával
- GIGABYTE GeForce VISION RTX 3070 8GB OC GDDR6 Videokártya
- ÁRGARANCIA! Épített KomPhone i5 12400F 16/32/64GB RAM RTX 5050 8GB GAMER PC termékbeszámítással
- Bomba ár! Dell Latitude 5400 - i5-8265U I 16GB I 256SSD I 14" HD I HDMI I Cam I W11 I Gari
- BESZÁMÍTÁS! 8TB Seagate Barracuda ST8000 SATA HDD meghajtó garanciával hibátlan működéssel
- Akciós áron eladó HP Dragonfly G3 /I7-1265U/32 GB/512B SSD/13,5"/FHD+/400nit/Touch
- AKCIÓ! Huawei Watch 4 Pro eSIM okosóra garanciával hibátlan működéssel
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
rite a program to add two large integer numbers of length up to 80 digits (no predefined type offers this range/precision !). One approach is to treat each number as an array of digits. The two integers (arrays) are added element by element, carrying from one element to the next when necessary. Each number is read digit by digit (a loop of getchar() until end of line is encountered) and stored in an array of digits.

