Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Framing Program


  • Please log in to reply
1 reply to this topic

#1 Vgamecoder

Vgamecoder

  • Members
  • 31 posts
  • OFFLINE
  •  
  • Local time:01:46 PM

Posted 23 September 2007 - 06:38 PM

I was trying to make a framing program that I am learning from a book and am desiding to change it a little to add in an age line as well just to see if I could modify it properly but for some reason it wont work.

#include <iostream>
#include <string>

int main()
{
string name;
int x;
int age;
string dname,dage,spaces,first,second;

cout <<"What Is Your Name? : ";
cin >> name;
cout <<"Thank You " << name << " Now How Old Are You? : ";
cin >> age;
while (age>100)
{
 cin >> age;
}

cout <<"Ok Thats All I Need To Know!\n";

dname = "Name : " + name + ".\n";
dage = "Age : " + age + ".\n";


spaces = dname.size(),' ';
second = "*" + spaces + "*";
first= second.size(),'*';

cout <<"\n\n";
cout << first;
cout << second;
cout <<"* " << dname << " *";
cout <<"* " << dage << " *";
cout << second;
cout << first;


system("PAUSE");

return 0;
}

but I get this error message :
25 c:\docume~1\patrik\desktop\c__~1\mine\lesson~1.cpp
invalid operands `const char *' and `const char[3]' to binary `operator +'

can any one help me fix this problem?
Please Help Me With These Problems
-------------------------------------------
How Do I Add Images To A C++ Program

BC AdBot (Login to Remove)

 


#2 Vgamecoder

Vgamecoder
  • Topic Starter

  • Members
  • 31 posts
  • OFFLINE
  •  
  • Local time:01:46 PM

Posted 27 September 2007 - 06:19 PM

any1?
Please Help Me With These Problems
-------------------------------------------
How Do I Add Images To A C++ Program




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users