Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,212 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,270 people online right now. Registration is fast and FREE... Join Now!




cprint

2 Pages V  1 2 >  
Reply to this topicStart new topic

cprint, i dont what to use

qaz1134
7 Jul, 2008 - 11:19 PM
Post #1

D.I.C Head
**

Joined: 21 May, 2008
Posts: 77



Thanked: 2 times
My Contributions
is cprint diffenrent form printf("");?

what about cout ans cint???? how are they declared?

stupid.gif
User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Cprint
8 Jul, 2008 - 01:50 AM
Post #2

Donkey DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 5,557



Thanked: 99 times
Dream Kudos: 2650
Expert In: ruling the world.

My Contributions
cprint?

cout and cin are C++ standards for console input and output. Here's an example program that uses them:
cpp
#include <iostream> // input/output stream

using std::cout; // using cout from the std namespace
using std::cin; // using cin from the std namespace
using std::endl; // using endl from the std namespace

int main () {
cout << "Enter a number: "; // Console OUT a prompt
int a; // declare an int
cin >> a; // Console IN some data
cout << "You entered " << a << endl; // output a string and the variable

cin.get (); // pause the window
return EXIT_SUCCESS; // program was executed successfully
}

Hope this helps smile.gif
User is online!Profile CardPM
+Quote Post

red_4900
RE: Cprint
8 Jul, 2008 - 02:08 AM
Post #3

Code T(h)inkers
****

Joined: 22 Feb, 2008
Posts: 830



Thanked: 11 times
My Contributions
I know printf, I know cout, but what is cprintf?
User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Cprint
8 Jul, 2008 - 02:16 AM
Post #4

Donkey DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 5,557



Thanked: 99 times
Dream Kudos: 2650
Expert In: ruling the world.

My Contributions
Do you mean sprintf(); ?
User is online!Profile CardPM
+Quote Post

subhendu
RE: Cprint
8 Jul, 2008 - 02:18 AM
Post #5

New D.I.C Head
*

Joined: 8 Jul, 2008
Posts: 1

QUOTE(gabehabe @ 8 Jul, 2008 - 02:50 AM) *

cprint?

cout and cin are C++ standards for console input and output. Here's an example program that uses them:
cpp
#include <iostream> // input/output stream

using std::cout; // using cout from the std namespace
using std::cin; // using cin from the std namespace
using std::endl; // using endl from the std namespace

int main () {
cout << "Enter a number: "; // Console OUT a prompt
int a; // declare an int
cin >> a; // Console IN some data
cout << "You entered " << a << endl; // output a string and the variable

cin.get (); // pause the window
return EXIT_SUCCESS; // program was executed successfully
}

Hope this helps smile.gif



There are nothing cprintf()?

User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Cprint
8 Jul, 2008 - 02:23 AM
Post #6

Donkey DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 5,557



Thanked: 99 times
Dream Kudos: 2650
Expert In: ruling the world.

My Contributions
If you mean sprintf(); then it's used to concatenate strings, like so:
cpp
#include <iostream> // input/output stream
#include <string> // sprintf ()

using namespace std;

int main () {
char * x = "hello";
char * y = "world";
char * z;
sprintf (z, "%s %s!", x, y);
cout << z << endl;

cin.get (); // pause the window
return EXIT_SUCCESS; // program was executed successfully
}

User is online!Profile CardPM
+Quote Post

captainhampton
RE: Cprint
8 Jul, 2008 - 04:32 AM
Post #7

Jawsome++;
Group Icon

Joined: 17 Oct, 2007
Posts: 518



Thanked: 2 times
Dream Kudos: 825
My Contributions
QUOTE(qaz1134 @ 8 Jul, 2008 - 12:19 AM) *

is cprint diffenrent form printf("");?

what about cout ans cint???? how are they declared?

stupid.gif


Not too sure what "cint" is either, I think you may mean cin?
User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Cprint
8 Jul, 2008 - 04:36 AM
Post #8

Donkey DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 5,557



Thanked: 99 times
Dream Kudos: 2650
Expert In: ruling the world.

My Contributions
Yeah, they meant cin, hence why I showed it in an example. smile.gif
User is online!Profile CardPM
+Quote Post

captainhampton
RE: Cprint
8 Jul, 2008 - 04:39 AM
Post #9

Jawsome++;
Group Icon

Joined: 17 Oct, 2007
Posts: 518



Thanked: 2 times
Dream Kudos: 825
My Contributions
QUOTE(gabehabe @ 8 Jul, 2008 - 05:36 AM) *

Yeah, they meant cin, hence why I showed it in an example. smile.gif


Oops, I apologize I missed that blink.gif
User is offlineProfile CardPM
+Quote Post

gkgranada
RE: Cprint
8 Jul, 2008 - 04:47 AM
Post #10

New D.I.C Head
*

Joined: 6 Jul, 2008
Posts: 9

the c in cprintf stands for color. i'm still trying to figure out how to use it for myself, so i can only tell you that much.

your output, when you use cprintf, would be in color.
User is offlineProfile CardPM
+Quote Post

red_4900
RE: Cprint
8 Jul, 2008 - 09:10 AM
Post #11

Code T(h)inkers
****

Joined: 22 Feb, 2008
Posts: 830



Thanked: 11 times
My Contributions
QUOTE(gabehabe @ 8 Jul, 2008 - 03:23 AM) *

If you mean sprintf(); then it's used to concatenate strings, like so:
cpp
#include <iostream> // input/output stream
#include <string> // sprintf ()

using namespace std;

int main () {
char * x = "hello";
char * y = "world";
char * z;
sprintf (z, "%s %s!", x, y);
cout << z << endl;

cin.get (); // pause the window
return EXIT_SUCCESS; // program was executed successfully
}


sorry my english sucks. what do the code do actually? point the *z to the words in both *x and *y? what does the first parameter in sprintf() function do?
User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Cprint
8 Jul, 2008 - 11:09 AM
Post #12

Donkey DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 5,557



Thanked: 99 times
Dream Kudos: 2650
Expert In: ruling the world.

My Contributions
The first parameter is the target string, which the new string will be written to. Think of how you would use printf(); because it's a lot like that... basically, you specify the string, and then give the string a value with similar syntax to printf();

And your English is really good, I've always thought that smile.gif
User is online!Profile CardPM
+Quote Post

2 Pages V  1 2 >
Reply to this topicStart new topic
Time is now: 12/4/08 01:17PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month