| | |
Help in correcting my code
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2008
Posts: 117
Reputation:
Solved Threads: 0
Hi:
I need some assistance in this code. I am trying to get this format.
1
.2
..3
...4
and so on.. i dont get any errors in the code but i get no o/p eitehr
I need some assistance in this code. I am trying to get this format.
1
.2
..3
...4
and so on.. i dont get any errors in the code but i get no o/p eitehr
C++ Syntax (Toggle Plain Text)
#include<iostream.h> int main() { int i; cout.fill('.'); for(i=i;i<10;++i) { cout.width(i); cout.fill('.'); cout<<i; }}
Last edited by Ancient Dragon; Nov 9th, 2008 at 12:56 pm. Reason: correct code tags -- use [ and ], not < and >
I get lots of pretty output, (gcc compiler):
While it does not really matter if your compiler supports this, its usually a better idea to use the most recent header files
...
INT X: You declare a variable and do not initialize it.
FOR X = X: You copy the value of X into X,
FOR (X to 10): Well based on the value we gave X (none) this could be anywhere in the range of integer values ( -2147483648 to 2147483647, on a 32-bit system ) number of iterations.
[code]
int x = 0;
for(i = x; i<10; ++i)
cout << "." << i;
[code]
~ or ~
Would accomplish what you're looking for in your loop.
There is no return 0; The system needs this value to know everything went 'ok' with the system.. any other value that is returned is usually viewed as an error.
•
•
•
•
Originally Posted by output
..-1208080203-1208080202-1208080201-1208080200-1208080199-1208080198-1208080197-
1208080196-1208080195-1208080194-1208080193-1208080192-1208080191-1208080190-
1208080189-1208080188-1208080187-1208080186-1208080185-1208080184-1208080183-
1208080182-1208080181-1208080180-1208080179-1208080178-1208080177-1208080176-
1208080175-1208080174-1208080173-1208080172-1208080171-1208080170-1208080169-
1208080168-1208080167-1208080166-1208080165-1208080164-1208080163-1208080162-
1208080161-1208080160-1208080159-1208080158-1208080157-1208080156-1208080155-
1208080154-1208080153-1208080152-1208080151-1208080150-1208080149-1208080148-
1208080147-1208080146-1208080145-1208080144-1208080143-1208080142-1208080141-
1208080140-1208080139-1208080138-1208080137-1208080136-1208080135-1208080134-
1208080133-1208080132-1208080131-1208080130-1208080129-1208080128-1208080127-...
C++ Syntax (Toggle Plain Text)
#include<iostream.h>
While it does not really matter if your compiler supports this, its usually a better idea to use the most recent header files
C++ Syntax (Toggle Plain Text)
#include <iostream>
...
C++ Syntax (Toggle Plain Text)
cout.fill('.'); for(i=i;i<10;++i) { cout.width(i); cout.fill('.'); cout<<i; }
INT X: You declare a variable and do not initialize it.
FOR X = X: You copy the value of X into X,
FOR (X to 10): Well based on the value we gave X (none) this could be anywhere in the range of integer values ( -2147483648 to 2147483647, on a 32-bit system ) number of iterations.
[code]
int x = 0;
for(i = x; i<10; ++i)
cout << "." << i;
[code]
~ or ~
C++ Syntax (Toggle Plain Text)
for(int i=0; i<10; i++) cout << "." << i;
Would accomplish what you're looking for in your loop.
C++ Syntax (Toggle Plain Text)
}
There is no return 0; The system needs this value to know everything went 'ok' with the system.. any other value that is returned is usually viewed as an error.
C++ Syntax (Toggle Plain Text)
return 0; }
I would love to change the world, but they won't give me the source code
![]() |
Similar Threads
- need help correcting "blackjack" c++ game (C++)
- ambiguous part 3 (C)
- Login Page Database connection to MSAccess (VB.NET)
- Sorting (Python)
- Need Help Correcting These errors (PHP)
- Can someone please help me with Binary Addtion. (C++)
- help me on this power of 2 (C)
- this code isn't working...why..plz help (C++)
Other Threads in the C++ Forum
- Previous Thread: Confusions related to Dll.
- Next Thread: Inheritance Trouble
| Thread Tools | Search this Thread |
api array based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






