im having some troble declaring strings in Visual Studio .Net, could some one please give me the standard form for this in .Net. Im using the strings lib. any help would be great... thanks in advance
Printable View
im having some troble declaring strings in Visual Studio .Net, could some one please give me the standard form for this in .Net. Im using the strings lib. any help would be great... thanks in advance
//editCode:string s; //A reference
s = new string();
sorry, that was c# code
Code:/* I had things on my mind so this
was a good way to help you and get
them off for a bit
*/
#include <iostream>
#include <string>
using namespace std;
int main()
{
/* Declare a string of un-specified
length. We can also do string userName[sumvalue]
*/
string userName;
/* Read in the string from user
*/
cout << "Your Name: ";
cin >> userName;
/* As is
*/
cout << "Original string: " << userName << endl;
/* Check to see if the first letter in
string is lowercase. If it is, lets
capitalize it!
*/
if((userName[0] > 97) && (userName[0] < 122))
{
userName[0] -= 32;
}
/* Changed
*/
cout << "Capitalized: " << userName << endl;
return 0;
}
You are aware that this declares an array of strings, right?Quote:
We can also do string userName[sumvalue]