Results 1 to 20 of 20
Thread: C++
Hybrid View
-
7th April 2010 21:00 #1
-
7th April 2010 21:52 #2: XaMaB; . 0.42
In God we Trust (all others must submit a X.509 certificate). , ()
-
8th April 2010 08:24 #3
,
Q9550@4.3GHz | 3D Mark 06 GTX 280 | 3D Mark 06 4870x2 | 3D Mark 06 5850
Asrock P67 Pro3|Intel Core i7 2600k|A-Data 2X2GB DDR3 @ 1866MHz 8-8-8-24|Sapphire 6850|WD Caviar Black 750GB Sata III 64MB|Coolermaster RealPower M700|Coolermaster HAF 922|Samsung SM P2350|A4Tech X755FS|Logitech Wave Keyboard
-
8th April 2010 10:25 #4
#include<iostream.h>
#include<conio.h>
int main()
{
int k;
cout<<k;
if
F3N0M3NA
-
8th April 2010 10:56 #5
#include<iostream.h>
#include<conio.h>
int main()
{
int k;
while (k < 0 || k > 999)
cout << "Input k (0-999): ";
cin >> k;
for (int i = 0; i >= 999; i++)
.. , "" .Last edited by svr; 8th April 2010 at 11:21.
MSI B450 Gaming Pro Carbon AC | Ryzen 9 5900x | HyperX Predator 3200 | Asus Strix 3090 | Kingston KC3000 2TB | WD Red 4TB | Dell G3223Q + LG 27UK650-W | Arctic Freezer 360 | Seasonic Focus GX-1000 | Lian Li O11 Dynamic
-
8th April 2010 11:12 #6Banned
Join Date: Nov:2007
Location: Sofia
Posts: 1,400
Code:// Zadacha.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <stdio.h> #include <vector> #include <iostream> using namespace std; int GetSumOfNumber(int number) { int n,sum=0; do { n=number%10; sum=sum+n; number=number/10; } while(number!=0); return sum; } vector<int> GetNumbers(int number) { vector<int> list; for(int i = 100; i < 1000; i++) { if(GetSumOfNumber(i) == number) { list.push_back(i); } } return list; } int _tmain(int argc, _TCHAR* argv[]) { int inputNumber=0; cout << "Enter a digit: "; cin >> inputNumber; vector<int> numbers = GetNumbers(inputNumber); vector<int>::const_iterator vector_iterator; for(vector_iterator = numbers.begin(); vector_iterator != numbers.end(); vector_iterator++) { cout << "Number: " << *vector_iterator << endl; } }
-
8th April 2010 11:26 #7
, , STL. ?

-.
Code:#include<iostream.h> #include<conio.h> int main() { int k; while (k < 0 || k > 999) { cout << "Input k (100-999): "; cin >> k; } for (int i = 100; i < 1000; i++) { int a = i / 100; // int b = (i % 100) / 10; // int c = (i % 100) % 10; // if (a + b + c == k) { cout << k << "\n"; } } }Last edited by svr; 8th April 2010 at 21:16.
MSI B450 Gaming Pro Carbon AC | Ryzen 9 5900x | HyperX Predator 3200 | Asus Strix 3090 | Kingston KC3000 2TB | WD Red 4TB | Dell G3223Q + LG 27UK650-W | Arctic Freezer 360 | Seasonic Focus GX-1000 | Lian Li O11 Dynamic
-
8th April 2010 11:45 #8Banned
Join Date: Nov:2007
Location: Sofia
Posts: 1,400
C- .
List- Dictionary- C#.
-
8th April 2010 13:38 #9
svr, , k . 27 ( 999).
E :
Code:#include <iostream.h> #include <conio.h> int main() { short k; cout<<" . : "; cin>>k; while(k<=0) { cout<<" . .\n"; cout<<" : "; cin>>k; } for(int i=100;i<=999;i++) { int s=0, j=i; while(j) { s+=j%10; j/=10; } if(s==k) cout<<i<<"\n"; } return 0; }
-
8th April 2010 14:11 #10
:
C++Code:#!/usr/bin/python k = int(raw_input("K = ")) print [i for i in range(100, 1000) if sum(map(int, list(str(i)))) == k]
, . .
"640K ught to be enough for anybody" - Bill Gates, 1981
::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel
-
8th April 2010 15:35 #11Banned
Join Date: Nov:2007
Location: Sofia
Posts: 1,400
(from i in new List<int>().Range(100, 1000) where maps(i, digit) select i).ToList().ForEach(x => Console.WriteLine(x));
C#.Code:class Program { static void Main(string[] args) { int digit; Console.WriteLine("Enter digit:"); digit = Convert.ToInt32(Console.ReadLine()); (from i in new List<int>().Range(100, 1000) where maps(i, digit) select i).ToList().ForEach(x => Console.WriteLine(x)); } static bool maps(int number, int sum) { return GetSumOfNumber(number) == sum; } static int GetSumOfNumber(int number) { int n, sum = 0; do { n = number % 10; sum = sum + n; number = number / 10; } while (number != 0); return sum; } } public static class Extensions { public static List<int> Range(this List<int> list, int start, int end) { List<int> newList = new List<int>(); for (int i = start; i < end; i++) { newList.Add(i); } return newList; } }
-
8th April 2010 14:52 #12
@svr, , , , ,
Q9550@4.3GHz | 3D Mark 06 GTX 280 | 3D Mark 06 4870x2 | 3D Mark 06 5850
Asrock P67 Pro3|Intel Core i7 2600k|A-Data 2X2GB DDR3 @ 1866MHz 8-8-8-24|Sapphire 6850|WD Caviar Black 750GB Sata III 64MB|Coolermaster RealPower M700|Coolermaster HAF 922|Samsung SM P2350|A4Tech X755FS|Logitech Wave Keyboard
-
8th April 2010 18:23 #13
, , , c# , ... , , , , ,
#include <iostream>
using namespace std;
int main () {
int k,br=0;
cout <<"Vuvedete k: ";
cin >>k;
cout <<"k="<<k<<endl;
for (int i=100;i<1000;i++) {
int a = i / 100;
int b = (i % 100)/10;
int c = (i % 100) % 10;
if (a + b + c == k)
{
cout << i << "\n";
br++;
}
}
if (br==0) cout <<"Nqma takiva tricifreni 4isla\n";
system ("pause");
return 0;
}Q9550@4.3GHz | 3D Mark 06 GTX 280 | 3D Mark 06 4870x2 | 3D Mark 06 5850
Asrock P67 Pro3|Intel Core i7 2600k|A-Data 2X2GB DDR3 @ 1866MHz 8-8-8-24|Sapphire 6850|WD Caviar Black 750GB Sata III 64MB|Coolermaster RealPower M700|Coolermaster HAF 922|Samsung SM P2350|A4Tech X755FS|Logitech Wave Keyboard
-
8th April 2010 19:13 #14
-
28th April 2010 13:58 #15Registered User
Join Date: Apr:2010
Location: rousse
Posts: 1
1 . , ;( PLS : ":
: , , .N , 31 ( 31 :1-;0-), , .
, : c ( , ). , 30 .........
-
28th April 2010 14:03 #16Registered User
Join Date: Aug:2006
Location:
Posts: 4,052
,
-
28th April 2010 15:45 #17
, , , .., , - , , .
UD3R|Q9550+1283|4x2 G.Skill@1066|MX500+1002FAEX+640AAKS+ST31 60|RX580-8GB|1841BLT|SS-760XP|Define7|z24i|Edifier S350DB
geniusloci: ) ; ) ; ) ?
nope|r.i.p.
-
28th April 2010 16:26 #18
?
for(i=0, i<10; i++)
for(j=0; j<10; j++)
for(k=0; k<10;k++)
if (i+j+k==n)
cout<< (i!=0?i:"") << ((j!=0||i!=0)j:"") << k;
Last edited by w00f; 29th April 2010 at 18:29.
Without involvement there is no commitment.
Never ask insurance salesman if you need insurance.
-
28th April 2010 17:39 #19
w00f, 3
, . .
"640K ught to be enough for anybody" - Bill Gates, 1981
::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel
-
29th April 2010 18:27 #20
, . .
Without involvement there is no commitment.
Never ask insurance salesman if you need insurance.




Reply With Quote

Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in