Why won't this output my string vertically?

THanks in advanced, bookmark.

#include <iostream>
#include <string>

using namespace std;
								 
void print (const string & s);
	

void main(){

print("blah");

 system("pause");
}
void print ( const string & s){
	  int i;   
	  int clrscr();  
		for(i=0;i<4;i++)  
 {          
	 cout << "\n %c", s;        
	  }			
	
	} 
v

main() is never void, it always returns an int according to the standard.

As to your actual problem, you are mixing up the syntax for printf (the function in the C standard library) with the syntax for cout. Look up the syntax for cout (or find one of countless examples on this site).

Hint: s[0] is the first character of the string s

thank you for you your help! :]

Why won't this output my string vertically?

THanks in advanced, bookmark.

#include <iostream>
#include <string>

using namespace std;
								 
void print (const string & s);
	

void main(){

print("blah");

 system("pause");
}
void print ( const string & s){
	  int i;   
	  int clrscr();  
		for(i=0;i<4;i++)  
 {          
	 cout << "\n %c", s;        
	  }			
	
	} 
v

well use stdio.h if u wanna use printf..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.